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

3 Answers 3


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.


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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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