As a Vim user, I prefer to remap the CapsLock key on my keyboard to Escape. It makes it easier to switch between insert and visual mode without having to stretch my pinky all the way up to the top-left corner of the keyboard. It’s a minor detail, but a hard one to live without!

There are several ways to achieve this, but these are the simplest steps I could find.

Install DConf Tools

DConf is a key-value database for storing desktop environment settings in Ubuntu, including our keyboard mappings. To edit thse settings, we need a utility called dconf-tools.

We can install it using the command:

sudo apt-get install dconf-tools

Now, we can modify the DConf settings for our keyboard!

Remapping via Command Line

Using the dconf command, we can easily set the xkb-options value in our key-value store:

dconf write /org/gnome/desktop/input-sources/xkb-options "['caps:escape']"

You can use dconf to set other options as well. A list of options can be found by doing:

man xkeyboard-config

Remapping via GUI Dconf Editor

Open up the DConf Editor by searching for it in the Unity dashboard:

Using the tree on the left, navigate to: → orggnomedesktopinput-sources

In the Value column, we can add our configuration: ['caps:escape'].

Thats it! Now, the CapsLock key will be remapped to function as the Escape key whenever we log into Ubuntu!

Questions? Corrections? Let me know in the comments!