Advertisement
cjfp

mintty.ahk

Jul 29th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; multiple scrolling modifiers in mintty using AutoHotKey
  2. ; save this text as mintty.ahk
  3.  
  4. ; preamble
  5. ; --------
  6.  
  7. ; install the latest AutoHotKey from here:
  8. ;
  9. ;   https://github.com/Lexikos/AutoHotkey_L/releases
  10.  
  11. ; next, configure mintty to scroll when Ctrl is pressed.  then this
  12. ; script will allow Shift scrolling as well as Shift+Ctrl scrolling.
  13. ; make sure this line is in .minttyrc:
  14. ;
  15. ;   ScrollMod=ctrl
  16.  
  17. ; the easiest way to start this from within Cygwin and immediately
  18. ; return control to bash is probably as follows:
  19. ;
  20. ;   $ explorer.exe mintty.ahk
  21. ;
  22. ; attempts to start autohotkey.exe from either bash or cmd /c did
  23. ; not return control nicely
  24.  
  25. ; script
  26. ; ------
  27.  
  28. ; tell AutoHotKey to reload the script if started again
  29.  
  30. #SingleInstance force
  31.  
  32. ; tell AutoHotKey not to show a tray icon
  33.  
  34. #NoTrayIcon
  35.  
  36. ; test whether the mintty window is active
  37.  
  38. ; note: it's possible to find the ahk_class of a window like this:
  39. ;
  40. ;   WinGetClass, class, A
  41. ;   MsgBox, The active window's class is "%class%".
  42. ;
  43. ; or by using the Window Spy feature from the AutoHotKey tray icon
  44.  
  45. #IfWinActive ahk_class mintty
  46.  
  47. ; map Shift and Shift+Ctrl hotkeys
  48.  
  49. ; + means Shift
  50. ; ^ means Ctrl
  51. ; "a::Send b" catches keypress a and sends b instead
  52. ; {Key} prevents Key from being interpreted as a string
  53.  
  54. +Up::Send ^{Up}
  55. +^Up::Send ^{Up}
  56.  
  57. +Down::Send ^{Down}
  58. +^Down::Send ^{Down}
  59.  
  60. +PgUp::Send ^{PgUp}
  61. +^PgUp::Send ^{PgUp}
  62.  
  63. +PgDn::Send ^{PgDn}
  64. +^PgDn::Send ^{PgDn}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement