Remapping Cap locks in a Debian based distro

I remap my Caps lock key on all my systems. Caps lock is a pretty useless key that’s sadly situated on the home row, the keyboard row where you naturally rest your hands while touch typing.

Having such a useless key on a such a prime piece of keyboard real estate is a waste.

There are popular alternative mappings, the Ctrl key being one of them. I myself prefer remapping Caps lock to another Escape key. I’m a Vim user and pressing Escape to exit insert mode is really a strectch.

Previously on Linux systems I used the xmodmap utility, created a file in my home directory which I loaded in my .bashrc.

Having recently installed Debian wheezy and Crunch Bang (#!) on two machines I found out that in Debian there is a keyboard file in /etc/default/ (/etc/default/keyboard) where you can set those options. No need to create a file and edit your .bashrc.

Here’s how you would remap Caps lock to act as another Escape:

XKBOPTIONS="caps:escape"

The command:

grep "caps:" /usr/share/X11/xkb/rules/base.lst

Will allow you to list other possible options (Control, Backspace, etc.). If you don’t have access to /etc/default/keyboard you can always use xmodmap.

Note that you will have to use dpkg-reconfigure or reboot for the changes to take effect.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s