For all vi/vim users out there, here’s how you can remap the CAPSLOCK key and replace it with the ESC key in your linux Xwindows environment.
First Add the following lines of text to your
!! No Caps Lock clear lock !! Make Caps_lock an escape key. keycode 0x42 = Escape
Second In your terminal, type the following command:
Your CAPSLOCK key is now remapped to the ESC key.
XWindows loads the
~/.Xmodmap file every time it starts, so you won’t have to keep typing the second command.
If you plug/unplug your USB keyboard, or dock/undock your laptop, XWindows may “forget” that mapping. You may need to repeat the second step in a terminal to restore the key mapping functionality.
I’ve tested it in Ubuntu, but it should work just the same for Fedora, RedHat, CentOS, Debian, openSUSE and pretty much anything that runs XWindows.
~/ stands for your home folder. For example, if I type
cd ~/ in my terminal, it takes me to