How To Remap Caps Lock To Escape
So I think we can all agree that whoever decided the caps lock key should get prime real estate should be stoned. Seriously, it’s right where an extremely useful key could be placed…like escape! Keys that can be toggled on and off, especially by software means, should not be given such huge buttons placed where other useful buttons should be in the first place. I am a heavy Vim user, so I use escape A LOT to change modes. If you’re an emacs *shuddersss* user you can remap this key to control but I am not going to tell you how as you should be using Vim anyway :p I’m just kidding, it’s a simple word substitution I will show in a minute. In order to get this setting to effect both console and X usages we will need to edit two different sets of files, both of which I will demonstrate. This is a Linux/UNIX specific tutorial so apologize to you poor Windows and OS X users who are stuck out in the cold. If it is demanded, I can show how to do this in OS X as it is a pain in the ass, but unfortunately I have no idea how to do this in Windows. Sorry about your luck
Anyways…
In order to get this to work in the console for all users, stick this in your /etc/rc.local (this is an Arch Linux example, you just need this to be in a file that will be ran as root during startup):
This should make it so Caps Lock is remapped to escape at all times in the virtual consoles. If you wanted it to be remapped to control, just substitute “Control” for “Escape” there towards the end…simple enough. Or you could just use Vim ![]()
In order for this to take effect in X, I use Xmodmap to remap the keycodes. The way I do it is to stick these two lines in the file ~/.Xmodmap:
keysym Caps_Lock = Escape
Then in my .xinitrc have a line that says:
You can run that command in the console and, since it will be run at every boot, it will be a persistent setting. Having escape at a much more reachable position makes productivity soar…at least for me. It allows me to Vim and Vimperate at a much faster speed. Hope this helps! Post comments if you have any questions, I am happy to help.
No comments yet.