5 ms·
I've never understood this. I have to take my (other) hand off to hit esc and get out of insert mode anyway. Additionally the fact that vim (as opposed to vi) g
by samfoo 16y ago
I've never understood this. I have to take my (other) hand off to hit esc and get out of insert mode anyway. Additionally the fact that vim (as opposed to vi) gets rid of the diagonal movements negates a lot of the benefit for me. I also switch into "nethack" mode when I try to use hjkl and that's never good for productivity.
- edanm 16y agoThere are two tricks to fix the escape problem. First, you can use ctrl+[ to get out of insert, which means moving your hands less. Even better (but requires customization), you can remap "jk" to get out of insert mode. Since "jk" is a combination that never comes up in actual writing, it works great. And it means you don't have to move your hands at all from home row.
- Jach 16y agoTo help the parent and or vim newbies avoid a google, and to show why this "customization" isn't scary or hard, all you need to do: :imap jk <Esc> (Literally type the angle brackets.) And if you want this as a standard default, make a .vimrc file in your home folder and stick the above without the colon in there.
- DennisP 16y agoI love you both.
- ichverstehe 16y agoIn English, maybe. In Danish there are plenty of jk's in actual writing. Ctrl+[ is terribly inaccessible on a bunch of international keyboards. Ctrl-C is the good one, really.
- andrewl 16y agoThe point is to map some easily-typed, but rarely-used, key combination as your escape key. I use jj. On the rare occasions I have to actually type jj, I just wait about a half second after typing the first j, and then the second j is received as a separate keystroke, and not interpreted as the second part of a mapping. And the only times I remember having to actually type jj are when I'm having the Vim keymapping conversation with somebody who asks "So how do you type 'jj'?
- kwantam 16y agoClearly the right way is 2ij^[ :) (EDIT: uhh, the :) is a smiley, not part of the command)
- ichverstehe 16y agoIt's a shame that all tutorials apparently tells you to use ESC to get out of insert mode. The real way to do it is Ctrl-c, which keeps you on the home row. It works even better if you map Caps Lock to Ctrl.
- statictype 16y agoYou can also use Ctrl-[ to go to normal mode. Ctrl-O takes you to normal mode for a single command and then automatically goes back to insert mode. Frankly, I find it easier to map Caps to Escape. Only problem is when you use other people's systems and you keep hitting caps lock when you mean to hit escape (Even if you're not in Vim)
- ichverstehe 16y agoThe trick with mapping Caps Lock to Ctrl is that you can use it for all your regular Ctrl-shortcuts. At least on MacBooks the regular Ctrl is placed totally impossible. But yeah, I /can't/ use others computers without getting utterly frustrated because of that. :)
- roel_v 16y agoIf you have a proper keyboard with a wrist rest, you only have to extend your fingers to press esc (not actually lift your hand, or move your whole hand which requires moving your whole under arm, if you're typing on a keyboard without wrist rest and where you have your hands hover over the keyboard. Ctrl-c requires you to twist your wrist in an awkward angle, several times a minute. If you keyboard really puts the esc key far away from the home row, you can remap caps lock to esc. All of this assume that you type 10-finger blind, but I guess if you can't even do that you have other priorities than learning vim.
- trominos 16y agoTaking your hands off of home row to get out of insert is also easily soluble -- you can map literally any key combo to esc. I use command-i (on a Mac), which is effortless to type and feels nicely symmetric to using i for insert.