How to remap keyboard for vim?
For Ubuntu 14.10
Step 1:
Install Gnome Tweak Tool
$ sudo apt-get install gnome-tweak-tool
Open gnome-tweak-tool > typing > Choose “Make Caps Lock an additional Ctrl key” instead of “Disabled” in the drop down list.
Now the Caps_Lock is remapped to Control_L.
Step 2:
Install xcape
$ sudo apt-get install git gcc make pkg-config libx11-dev libxtst-dev libxi-dev
$ git clone https://github.com/alols/xcape.git
$ cd xcape
$ make
$ sudo make install
Then run
xcape -e '#66=Escape'
Drawback: need to this line after every reboot.
Now Caps_Lock is remapped to Escape when press and release without pressing other keys.
Sources:
https://askubuntu.com/questions/33774/how-do-i-remap-the-caps-lock-and-ctrl-keys
https://github.com/alols/xcape