Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers

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 (bugs.launchpad.net/ubuntu/+source/x11-xserver-utils/+bug/576102) and here (bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/524774) –  intuited Jun 8 '10 at 21:28
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.