4 ms·
The Escape key on modern keyboards is a lot further from home row than it was on Bill Joy’s keyboard back when he designed vi. Hitting Escape is usually unneces
by oinksoft 15y ago
The Escape key on modern keyboards is a lot further from home row than it was on Bill Joy’s keyboard back when he designed vi. Hitting Escape is usually unnecessary; Ctrl+[ is a lot closer, and more comfortable.
That's not an "anti-pattern," that's an opinion. I think C-[ is uncomfortable as hell.
- blahedo 15y agoIt's probably more comfortable than reaching an unremapped modern PC Escape key, though. And if you do light remapping, making Caps a Control instead (as in the Mac's Keyboard control panel) makes ^[ even easier. If you're really down with keyboard remapping, though, go for putting the Escape key somewhere closer. I learned a Sun keyboard in grad school, which put Esc where PCs have backquote/tilde, and I've remapped every keyboard I use regularly to this arrangement. (I also swap backslash and backspace for roughly the same reason.)
- Dobbs 15y agoI have caps setup as a third ctrl key. So at least for me Ctrl-[ is super easy to hit, as is every other ctrl based modifier. I greatly prefer this setup. I never used Caps before and now I have a useful key in a useful position.
- icebraining 15y agoIt depends on the keyboard layout, though. To write [ I need to type Right Alt + 8.
- graywh 15y agoSometimes you can hit ctrl-<key where [ is on US layout>, but I forget if/when it works that way.
- oe 15y agoMany of the tips involving keys like {[^$ look cool, but are impossible to hit fast on a non-US keyboard.
- jhchabran 15y agoI highly suggests switching to QWERTY while coding in Vim. You should be already familiar with it and it only takes a few days to be really at ease with it. We don't need characters from our languages in our code (at least most of the time).
- reycharles 15y agoSame here. ctrl-3 works also, for some reason.
- humbledrone 15y agoGiven how common the escape key is in Vim, I swapped caps-lock and escape, which IMO is vastly more comfortable than C-anything.
- graywh 15y agoSince I learned Vim with the normal Escape key location and find it easier to hit than the normal Ctrl keys, I turn caps into another Ctrl. Plus, everything has Ctrl key shortcuts.
- gnosis 15y agoFor me hitting the ordinary control key is even more comfortable than hitting the caps-lock key. That's because to hit the caps-lock key I have to lift my little finger and move it to the left, while to hit the control key I only have to press down with the part of my palm that's directly below my little finger (and directly above the control key).
- andrewl 15y agoI have jj mapped to Esc in insert mode. If you type it quickly, the two j characters vanish and you escape out of insert mode. If you type them slowly you get two j characters in your text. I rarely need two j's in my text, of course, so it's a good escape key sequence, but pick whatever you want. I chose jj because it keeps me on home row.
- oinksoft 15y agoIck, that makes for lag if you just type 'j'.
- aiscott 15y agoHopefully you type fast enough that by the time your brain noticed any lag on the "j", you are already a few letters down the line. If you are too dependent on visual feedback while typing, you'll have a difficult time typing fast in any environment. That said, I don't think I'd ever try remapping escape. I have long fingers though.
- oinksoft 15y agoIt's just an ugly way to do a mapping. I used to have some mappings like these in my rc, but I removed them in favor of similar ones that backtrack instead. If the author wants "jj" to be <ESC>, it can be done without the lag: You just check the previous character on 'j' and then take action accordingly.
- edanm 15y agoCan you show us the script you use to make this happen? Sounds interesting.
- tygorius 15y agoSometimes my muscle memory winds up telling me it needs. That's how I wound up mapping both jj and ;l to Esc. The first gets used when I've finished an insertion and am about to pause to think (it feels more emphatic) while the second gets used when I'm in flow and know exactly what I'm going to do next. I once read a thread discussing the topic of Esc replacements and was astounded to learn that some people had reinvented chording: they mapped all the permutations of h,j, and k into Esc replacements and then simply banged all three at the same time to exit!
- dekz 15y agoOn the contrary I find it quite pleasant, but it all relies on the having Caps Lock bound to Control.
- ulisesrmzroche 15y agoI prefer ctrl-c even if people flip their shit about this half the time.
- gnosis 15y agoI've used vim for so long that I don't find hitting the escape key to be a bother -- in fact, I don't even notice it at all anymore. It's the same with hitting : It would take much more effort for me to retrain myself to use control-[ or some other key than to keep using escape. On the other hand, if I was just starting out, I might consider remapping jj or jk to escape. I've already mapped the space bar to : but I keep forgetting to use it. It's all muscle memory at this point, and a bother to retrain it.