Created
March 30, 2022 15:40
-
-
Save fl3pp/693b34dfcce2ca4b1cabd8114a22a046 to your computer and use it in GitHub Desktop.
System-wide vim mapping for arrow keys using Alt modifier
This file contains 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
#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