How to swap Caps-lock and Esc keys in UbuntuWed, Oct 22, 2008 in Desktop Programming
Here’s a productivity tip that has saved me countless work while typing. Swap your Caps-lock and Escape keys. If you’re like most people, you use Caps-lock virtually never, and Escape quite a lot. Especially if you’re a programmer who happens to use the best text editor, Vim. Read on to learn how to do this.
An easy way to do it on Ubuntu with Gnome: step one, create a .xmodmaprc file. You can run the following command to create the file and put the correct contents into it:
echo > ~/.xmodmaprc '! Swap caps lock and escape remove Lock = Caps_Lock keysym Escape = Caps_Lock keysym Caps_Lock = Escape add Lock = Caps_Lock'
Step two is to make this run every time you log in. Open up System-Preferences-Settings. Click the Add button to add a new entry to the additional startup programs list. In the “name” box, enter “xmodmap” or something else descriptive. In the Command box, enter “/usr/bin/xmodmap /home/[user]/.xmodmaprc”, where [user] is your username.
And now get used to being able to hit Escape without reaching for it. If you like this, you might also be interested in using the Dvorak keyboard – I can type on either Dvorak or QWERTY, but Dvorak has saved me from something approaching total paralysis of the hands, so it’s worth checking into also.
As your reward for reading this far,
Q: what’s the integral of 1/cabin?
A1: Natural Log Cabin
A2: Houseboat (Natural Log Cabin + C)
I'm Baron Schwartz, the founder and CEO of VividCortex. I am the author of High Performance MySQL and lots of open-source software for performance analysis, monitoring, and system administration. I contribute to various database communities such as Oracle, PostgreSQL, Redis and MongoDB. More about me.