Maps Caps Lock key to Escape
One thing that bothered me about vim for some time was the delay in getting access to command mode. Reaching up and over to Escape just felt unnatural. So why not bind this action to a closer key?
A good candidate is the Caps Lock key. I almost never need to use the Caps Lock key in normal use. Who wants to write in all caps? However, this key is much closer to the home row relative to the Escape key. It turns out there isn’t a way to do this in vim. Key bindings bind a command to a key not normally associated with that command. Binding a key to another key, regardless of what command that key maps to, is outside of vim’s purview.
To solve this, we need to change the mapping of the keycodes at a lower level. The following script will allow you to toggle this mapping on and off. Once toggled, it lasts across restarts. So you only need to toggle it again if you need to use Caps Lock for its original purpose. Its use is explained in the comments:
Continue Reading “Maps Caps Lock key to Escape”
January 31, 2009 - 8:15 PM Comment (1)







