Last Updated: February 25, 2016
·
418
· cmaureir

Map «Caps Lock» to «Esc»

First of all, you need to know the "keycode" of your «Caps Lock» key,
for this you can use:

xev

Just press the «Caps Lock» key and you will se a message containing the "keycode".

Now add this to your ~/.Xmodmap file, if you don't have it, you can create it.

clear lock
keycode YourKeyCode = Escape

Now you can load the file:

xmodmap ~/.Xmodmap

And that's all.
You can use an nearest «Esc» key with Vim.