How can I remap my Caps-Lock key to Escape (for Vim) in Snow Leopard?

Obviously, in Linux I can use xmodmap. On Leopard, I used an InputManager called PCKeyboardHack. But InputManagers are now broken.

How can I preserve my sanity and keep on using Caps Lock to Escape in OS X 10.6?


I may be way off as I'm nowhere near my Mac to check, but would Ukelele be able to remap the Caps lock? I know you can remap the Caps lock using system preferences too, but I think the possible replacements are limited (again away from a Mac to test)...

You could also see if doublecommand has that mapping included, as reports suggest it works in 32bit kernel mode in SL at least...

EDIT:

There seems to be a PCKeyboardHack fork for SL:

http://github.com/bjeanes/PCKeyboardHack


It's not really an answer to your question, but I imagine you want to remap the key so your finger hasn't so far to travel to switch Vim modes. A week or two ago I discovered that Ctrl-[ is the same as hitting Esc, and easier to type even though it's two keys.

I'd suggest teaching your fingers to do Ctrl-[ instead, then you don't need to remap any keys and you don't lose Caps-lock functionality.


  1. Open System Preferences
  2. Open the Keyboard Preferences
  3. Make sure you're on the 'Keyboard' tab
  4. Click 'Modifier Keys'
  5. Change them to whatever you like.