How to remap the MacBook caps-lock key to Escape
If you use Vim, it’s quite nice to be able to use the Caps Lock key as the Escape key. That’s not the easiest thing to do on the Mac.
If you search out on Google and blogs, you’ll be told that the way to do this is to use PCKeyboardHack. You just remap Caps Lock to keycode 53 (Escape).
But not so fast. That works, but it doesn’t work reliably. Sometimes you have to hit Caps Lock two or three times before the Escape registers. This may be because of the very subtle modification Apple have made to post-2007 MacBooks such that you have to hold down Caps Lock to activate it, so that you don’t activate it unless meaning to.
What you need first is KeyRemap4MacBook, a plugin which lets you enable what it calls “CapsLock LED Hack”.
To do this, then:
1. First, uninstall DoubleControl, if you are using it.
2. Install KeyRemap4MacBook first.
3. Then install PCKeyboardHack.
There’s still a problem with this, though: now the green LED on the Caps Lock key is on all the time. I’m considering placing a small piece of black adhesive tape over the LED. I’m guessing this also draws a very small amount of power, which I’m not too thrilled about. It’d be neat if I could turn the LED off. Or maybe use it to display something interesting (maybe Vim could use it to tell me whether it is insert mode?).
Another teeny little Mac life hack: I have a habit now that whenever I am using my laptop in public with my headphones plugged in to twiddle the F11 or F12 volume control keys to ensure that the audio is being emitted through the headphones rather than the speakers. A short blip will be emitted to represent the current audio output volume. I do this because sometimes the headphones aren’t quite in the socket - the current range of Macs seems to leave them suspended slightly outside of the body. It’s very easy to knock them out.