uo_big
Last Updated: February 25, 2016
·
1.332K
· mislav

Map Caps Lock key to both Control and Escape

The most powerful hack to boost ease of use of both terminal and Vim for me was mapping my Caps Lock key to Control. In OS X, you can easily do it in Keyboard → Modifier Keys:

This brings Control to the home row, but leaves us with a problem of Escape still being an uneasy reach. Sure, you can exit Vim insert mode with C-[ instead of Esc, but Escape is needed for more functionality than that.

KeyRemap4MacBook is a free and open source utility for advanced remapping of keys. (Note: installing it requires restart.) It can map the left Control key in such a way that it sends an Escape if simply pressed and not held. Activate the following built-in option:

Control_L to Control_L
(+ when you type Control_L only, send Escape)

Thanks: Steve Losh