Hacker News new | ask | show | jobs
by jdludlow 5259 days ago
Remap caps-lock to escape

Ugh, why? Remapping caps-lock to Ctrl makes more sense to me. The Escape key is still in the upper-left, and banging somewhere in that vicinity usually hits it. Also Ctrl-C equals Escape in vim, so you still have quick access to it from the home row if you want.

7 comments

I remapped Capslock to:

"Ctrl if it's held down and pressed with another key, Escape if it's pressed and released on its own."

It works really nicely once you get used to it.

EDIT:

To do that I first mapped Capslock to Ctrl using the normal Apple Keyboard prefs, then used KeyRemap4MacBook and checked this setting: http://i.imgur.com/99cNs.png

http://pqrs.org/macosx/keyremap4macbook/

I could definitely get used to that. Did you remap that in vim itself, or from your operating system?
How did you get your operating system to do that?
I remapped Caps Lock to Escape too and it interestingly one of the best hacks I ever did. On my keyboard at least, Esc is far away from the home row, and the smallest button on my keyboard (1x1.6 cm^2). Caps Lock is the fourth largest button (1.8x3.2 cm^2) and is only a small distance to the left. I can easily reach Ctrl with my pinky, but not Esc.

It's also useful outside of Vim, in almost any application Esc means "Cancel the current operation". The only disadvantage I see is that I'm constantly toggling Caps Lock on other PC's.

I have "jj" mapped to esc, caps-lock remapped to Ctrl.

jj only an issue if you are tying things like jj.Reddick or jj abrams :)

The reason is capslock is on the home row, and control is not. I use a Kinesis Advantage keyboard, so ctrl is also in a good spot (thumb), but for most people, less stress would be to use the homerow key rather than bend their pinky to hit ctrl. It's a minor thing but it adds up.

If you use escape with vim you're actually "doing it wrong" in the sense that vim was not designed for your keyboard. On older keyboards escape was where the Tab key is now. There's no reason to abuse your wrists with repetitive motions going up to the escape key.

Eh. I already have two ctrl keys, and use escape far more often then either of them. Ctrl-z is the only common thing I do with control, and I don't need that to be easily done from the home row.
Ctrl-[ is escape, so if your caps lock is a control key you only need to move your pinkies a tiny amount to hit escape.
This. And it works most places in the terminal.
I remapped space to colon (so I can enter commands without shifting for colon). :)
well nnoremap ; : is a good way to do that and keep space open for other things unless you use ; for something more useful.
I'd recommend not mapping over ; It's very useful. It repeats your last f or F command. I probably use it a dozen times a day.

If you do map something on top of it, consider moving it elsewhere.

That's actually quite useful... I was working off a modified vimrc that had this remap on it and got used to it. Maybe leader f to redo? Though I haven't checked if that is taken by something else. Thanks for the tip.