Here is a question: when was the last time you used the Caps Lock key on purpose? When was the last time you went “hey, I wish I could type in ALL CAPS ALL THE TIME”! Chances are that unless you are a Nigerian prince in a dire need of a money transfer, your use of Caps Lock is very limited.
In fact, I’m willing to bet that you hit that key by accident much more often, than on purpose. So why not get rid of it. And I don’t mean physically remove it – that’s just stupid. I mean, remap it to something more useful.
Since I’m a vim user, I decided to remap my Caps Lock to the Escape key. This way I can have an easily accessible Esc under my pinky. This way switching back to normal mode is just single movement. I don’t have to lift my left hand from the home row to hit the actual Esc, and I don’t have to do a two hand motion to use the Ctrl+[ equivalent. Here is how you do it.
First open up your ~/.Xmodmap file and add the following lines:
remove Lock = Caps_Lock keysym Caps_Lock = Escape
Then activate your changes by doing:
If you want to map Caps Lock to a different key, simply replace Ecape in the sample above with something else like:
- Control_L or Control_R for either left or right Ctrl key
- Alt_L or Alt_R for Alt or AltGr keys
- Super_L or Super_R for the respective "Windows Logo" keys
- Shift_L or Shift_R for respective shift keys
Assigning it to AltGr is also an attractive idea for me, since the Caps Lock position is a bit more accessible than the usual AltGr which I use for typing Polish accented letters. I don't really see what would be the point of mapping it to Shift, but hey - maybe someone will find that useful.
You can find the rest of key mappings by using the xev utility. Just run it, and start pressing letters and you will see key codes and names for your keys. You can use the same technique to remap almost every single key on the keyboard to whatever you like. :mrgreen:
[tags]keymap, key mapping, remapping keys, caps lock, remapping caps lock, escape, caps lock to escape, esc[/tags]