把 Caps Lock 變成智慧的 Control 以及 Escape :
- 單獨輕按一下就是 Escape 。
- 若按下時同時按著其他鍵,就會是 Control 。
這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)
- Send Escape if you tap Caps Lock alone.
| #Requires AutoHotkey v2 | |
| ; Install the keyboard hook to capture the real key state of the keyboard | |
| InstallKeybdHook(true) | |
| ; Disable the CapsLock key | |
| SetCapsLockState("alwaysoff") | |
| ; Send esc key when Capslock is pressed as default | |
| g_DoNotAbortSendEsc := true | |
| $*Capslock::{ ; Capture CapsLock key press | |
| global g_DoNotAbortSendEsc ; use global variable g_DoNotAbortSendEsc |