Last active
September 14, 2020 20:35
-
-
Save greneholt/3007229 to your computer and use it in GitHub Desktop.
AutoHotkey semicolon arrow keys and capslock to ctrl/escape
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SingleInstance force | |
; Necessary for semicolon arrow to work, since it can send semicolon. | |
#InstallKeybdHook | |
; Better performance. | |
SendMode Input | |
; Kill CapsLock. | |
SetCapsLockState AlwaysOff | |
; I swap Ctrl and Alt using SharpKeys, so we need to fix alt+tab. | |
Ctrl & Tab::AltTab | |
; Window switching | |
#k::WinActivate Terminal ahk_exe putty.exe | |
#s::WinActivate Kakoune ahk_exe putty.exe | |
;#s::WinActivate ahk_exe sublime_text.exe | |
;#s::WinActivate ahk_exe vncviewer.exe | |
#v::WinActivate ahk_exe vncviewer.exe | |
#c::WinActivate ahk_exe firefox.exe | |
#p::WinActivate ahk_exe pidgin.exe | |
#a::WinActivate ahk_exe slack.exe | |
;#a::WinActivate ahk_exe Ripcord.exe | |
; Paste in Putty and shift+arrow fixes. | |
#IfWinActive ahk_exe putty.exe | |
^+v::Send +{Insert} | |
+Left::Send {Escape}[1;2D | |
+Right::Send {Escape}[1;2C | |
+Up::Send {Escape}[1;2A | |
+Down::Send {Escape}[1;2B | |
#IfWinActive | |
; Window management | |
#w::WinClose A | |
#f:: | |
WinGet maximized, MinMax, A | |
if (maximized) { | |
WinRestore A | |
} else { | |
WinMaximize A | |
} | |
return | |
last_ctrl_down_time := 0 | |
ctrl_used := false | |
ctrl_down := false | |
*CapsLock:: | |
if (ctrl_down) { | |
return | |
} | |
Send {Ctrl Down} | |
last_ctrl_down_time := A_TickCount | |
ctrl_used := false | |
ctrl_down := true | |
return | |
*CapsLock Up:: | |
Send {Ctrl Up} | |
ctrl_down := false | |
if (ctrl_used) { | |
return | |
} | |
time_elapsed := A_TickCount - last_ctrl_down_time | |
if (time_elapsed <= 250) { | |
Send {Blind}{Esc} | |
} | |
return | |
last_semicolon_down_time := 0 | |
semicolon_used := false | |
semicolon_down := false | |
*;:: | |
if (semicolon_down) { | |
return | |
} | |
ctrl_used := true | |
semicolon_used := false | |
semicolon_down := true | |
last_semicolon_down_time := A_TickCount | |
return | |
*; Up:: | |
semicolon_down := false | |
if (semicolon_used) { | |
return | |
} | |
time_elapsed := A_TickCount - last_semicolon_down_time | |
if (time_elapsed <= 250) { | |
Send {Blind}{;} | |
} | |
return | |
~*a:: | |
~*b:: | |
~*c:: | |
~*d:: | |
~*e:: | |
~*f:: | |
~*g:: | |
~*m:: | |
~*p:: | |
~*q:: | |
~*r:: | |
~*s:: | |
~*t:: | |
~*v:: | |
~*w:: | |
~*x:: | |
~*z:: | |
~*1:: | |
~*2:: | |
~*3:: | |
~*4:: | |
~*5:: | |
~*6:: | |
~*7:: | |
~*8:: | |
~*9:: | |
~*0:: | |
~*Backspace:: | |
~*Delete:: | |
~*Insert:: | |
~*Home:: | |
~*End:: | |
~*PgUp:: | |
~*PgDn:: | |
~*Tab:: | |
~*Return:: | |
~*,:: | |
~*.:: | |
~*/:: | |
~*':: | |
~*[:: | |
~*]:: | |
~*\:: | |
~*-:: | |
~*=:: | |
~*`:: | |
~*F1:: | |
~*F2:: | |
~*F3:: | |
~*F4:: | |
~*F5:: | |
~*F6:: | |
~*F7:: | |
~*F8:: | |
~*F9:: | |
~*F10:: | |
~*F11:: | |
~*F12:: | |
ctrl_used := true | |
return | |
*i:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{Up} | |
semicolon_used := true | |
} else { | |
Send {Blind}i | |
} | |
return | |
*j:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{Left} | |
semicolon_used := true | |
} else { | |
Send {Blind}j | |
} | |
return | |
*k:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{Down} | |
semicolon_used := true | |
} else { | |
Send {Blind}k | |
} | |
return | |
*l:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{Right} | |
semicolon_used := true | |
} else { | |
Send {Blind}l | |
} | |
return | |
*h:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{PgUp} | |
semicolon_used := true | |
} else { | |
Send {Blind}h | |
} | |
return | |
*n:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{PgDn} | |
semicolon_used := true | |
} else { | |
Send {Blind}n | |
} | |
return | |
*o:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{End} | |
semicolon_used := true | |
} else { | |
Send {Blind}o | |
} | |
return | |
*u:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{Home} | |
semicolon_used := true | |
} else { | |
Send {Blind}u | |
} | |
return | |
*y:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{Backspace} | |
semicolon_used := true | |
} else { | |
Send {Blind}y | |
} | |
return | |
*Space:: | |
ctrl_used := true | |
if (semicolon_down) { | |
Send {Blind}{Delete} | |
semicolon_used := true | |
} else { | |
Send {Blind}{Space} | |
} | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment