Skip to content

Instantly share code, notes, and snippets.

@mxdevmanuel
Last active May 4, 2023 01:28
Show Gist options
  • Save mxdevmanuel/af7e2f672444d609cd134be9329150bc to your computer and use it in GitHub Desktop.
Save mxdevmanuel/af7e2f672444d609cd134be9329150bc to your computer and use it in GitHub Desktop.
AutoHotkey CAPSLOCK to Control on Hold and ESC on tap. Also VIM key movements using RAlt as a layer modifier
; If CAPSLOCK is up before a 100 milisecond send Escape else keep CTRL pressed until CAPSLOCK is released
*CapsLock::{
Send "{Blind}{Ctrl Down}"
released := KeyWait("CAPSLOCK", "T0.1")
If (released)
Send "{Blind}{Ctrl Up}{Esc}"
}
*CapsLock up::Send "{Blind}{Ctrl Up}"
; Make ALT + CAPSLOCK toggle CAPS
!CapsLock::CapsLock
; Use RAlt as a second layer
; Vim keys for arrows
*!h::SendEvent "{Blind>!}{Left Down}"
*>!j::SendEvent "{Blind>!}{Down Down}"
*>!k::SendEvent "{Blind>!}{Up Down}"
*>!l::SendEvent "{Blind>!}{Right Down}"
*>!h up::SendEvent "{Blind>!}{Left Up}"
*>!j up::SendEvent "{Blind>!}{Down Up}"
*>!k up::SendEvent "{Blind>!}{Up Up}"
*>!l up::SendEvent "{Blind>!}{Right Up}"
>![ up::SendEvent "{Browser_Back}"
>!] up::SendEvent "{Browser_Forward}"
>!<::SendEvent "{Home}"
>!>::SendEvent "{End}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment