把 Caps Lock 變成智慧的 Control 以及 Escape :
- 單獨輕按一下就是 Escape 。
- 若按下時同時按著其他鍵,就會是 Control 。
這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)
- Send Escape if you tap Caps Lock alone.
- Send Control if you press Caps Lock with another key.
For both Vim and Emacs world.
Install XCAPE (xcape
). (Linux utility to configure modifier keys to act as other keys when pressed and released on their own.)
Ubuntu:
sudo apt-get install xcape
# make CapsLock behave like Ctrl:
setxkbmap -option ctrl:nocaps
# make short-pressed Ctrl behave like Escape:
xcape -e 'Control_L=Escape'
The effect should apply immediately.
Append code from Step 2 to file ~/.xprofile
to run the command when X starts.
Happy Vimmimg!
Open System Preferences, then go into the Keyboard preference pane, click Modifier Keys…, and change Caps Lock Key to Control.
Download and install Karabiner. (A powerful and stable keyboard customizer for OS X)
In Change Key pane, find Change Control_L Key (Left Control). Then toggle on the following:
Control_L to Control_L
(+ when you type Control_L only, send Escape)
And the effect should apply immediately.
Happy Vimmimg!
- Download and install AutoHotKey.
- Use the script CapsLockCtrlEscape.ahk.
Happy Vimmimg!