-
-
Save githusr/7355e6038cd2af4b234fa9a9002f2c71 to your computer and use it in GitHub Desktop.
AutoHotkey script to map Caps Lock to Escape when it's pressed on its own and Ctrl when used in combination with another key, à la Steve Losh. Adapted from one that does something similar with the Ctrl Key on the Vim Tips Wiki (http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281). (Plus contribs from @randy909 & @mmikeww.)
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
#Requires AutoHotkey 2.0.19 64-bit | |
#SingleInstance Force | |
ProcessSetPriority "High" | |
SetStoreCapsLockMode false | |
LShift & RShift:: SetCapsLockState !GetKeyState("CapsLock", "T") | |
*CapsLock:: { | |
Send "{LCtrl down}" | |
LastCtrlKeyDownTime := A_TickCount | |
KeyWait "CapsLock" | |
Send "{LCtrl up}" | |
if A_PriorKey = "CapsLock" && A_TickCount - LastCtrlKeyDownTime <= 250 { | |
Send "{Esc}" | |
} | |
} | |
<!q::!F4 | |
<!b::^b | |
<!f::^f | |
<!h::^h | |
<!n::^n | |
<!p::^p | |
*<^b:: Send "{Blind^}{Left}" | |
*<^f:: Send "{Blind^}{Right}" | |
*<^h:: Send "{Blind^}{BS}" | |
*<^n:: Send "{Blind^}{Down}" | |
*<^p:: Send "{Blind^}{Up}" | |
#HotIf WinActive("ahk_exe msedge.exe") | |
<^q::^Tab | |
<^Tab::^q | |
#HotIf | |
#e:: { | |
if WinExist(" - File Explorer") { | |
WinActivate | |
} else { | |
Run "explorer" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment