Down with Caps Lock!

The Caps Lock key does me no good at all, but I use Esc constantly as a vim user. So, I set about making the Caps Lock key a second Esc.

On Linux, I used the xmodmap command (because I spend all my time in X – the console is not necessary) in my .xinitrc file like so:

xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "keycode 66 = Escape"

Because I am shackled to a Windows box day after day, I also wanted to make this work in that environment, and luckily, I can. It just took a brave bit of registry editing, like so:

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlKeyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,00,3a,00,00,00,00,00

It makes a huge difference to not have to reach for the Esc key all the time, but it makes it so easy that I keep shifting into command mode while typing in Word. A small price, especially since I realize I’m happiest writing in vim anyway.