Skip to content

Instantly share code, notes, and snippets.

@fl3pp
Created March 30, 2022 15:40
Show Gist options
  • Save fl3pp/693b34dfcce2ca4b1cabd8114a22a046 to your computer and use it in GitHub Desktop.
Save fl3pp/693b34dfcce2ca4b1cabd8114a22a046 to your computer and use it in GitHub Desktop.
System-wide vim mapping for arrow keys using Alt modifier
#NoEnv
#InstallKeybdHook
#UseHook On
SendMode Input
SimulateKeyDown(key, modifier, direction)
{
Send %modifier%{ %direction% }
KeyWait, %key%, T.3
If (!ErrorLevel) {
Return
}
While (GetKeyState(key, "P")) {
Send %modifier%{ %direction% }
Sleep 50
}
Return
}
!h::SimulateKeyDown("h", "", "Left")
!j::SimulateKeyDown("j", "", "Down")
!k::SimulateKeyDown("k", "", "Up")
!l::SimulateKeyDown("l", "", "Right")
+!h::SimulateKeyDown("h", "+", "Left")
+!j::SimulateKeyDown("j", "+", "Down")
+!k::SimulateKeyDown("k", "+", "Up")
+!l::SimulateKeyDown("l", "+", "Right")
^!h::SimulateKeyDown("h", "^", "Left")
^!j::SimulateKeyDown("j", "^", "Down")
^!k::SimulateKeyDown("k", "^", "Up")
^!l::SimulateKeyDown("l", "^", "Right")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment