Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What command do I have to enter to be able to leave editmode by pressing CapsLock in Vim?

share|improve this question
up vote 10 down vote accepted

In Linux, use the xmodmap utility

xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'

In Windows, you can use AutoHotkeys, or change your registry settings.

See this tip from Vim wiki for detailed instructions for Windows and also the linked tip for Linux.

share|improve this answer
Note that there is a bug in some new versions of linux (Ubuntu 10.04, for example) that prevents this from working. More info here ( and here ( – intuited Jun 8 '10 at 21:28

In Ubuntu 9.04 using Gnome, this is most easily accomplished via the GUI. Go to System -> Preferences -> Keyboard, switch to the "Layouts" tab and click the "Layout Options" button. You'll find several "Caps Lock key behaviors" there to choose from. You can make CapsLock and additional Escape and you can swap both, e.g.

share|improve this answer

Unfortunately, it's not as simple as just entering a command, but it is a well-investigated topic. I'd go with the AutoHotkey method, if I were you.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.