5 ms·
With emacs, you'd still likely be a bit less productive initially, but at least it doesn't have that weird "insert mode" stuff, so you can use the arrow keys, b
by davidw 16y ago
With emacs, you'd still likely be a bit less productive initially, but at least it doesn't have that weird "insert mode" stuff, so you can use the arrow keys, backspace, and so on.
- stevejohnson 16y agoSounds like you miss the point of the article: that you can make vim at least as incremental as emacs if you take the right approach.
- davidw 16y agoI got that, but I think emacs approach makes more sense, even though it's still by no means an easy system to deal with for a novice.
- andrewf 16y agoArrow keys work fine in VIM, whether you're in insert mode or not. The argument for not using them is that it's less productive to use them than HJKL, because you need to move your hand back and forth between the home row and the arrow keys. I never broke the habit myself, and I suspect the benefit is a lot smaller on a laptop keyboard versus an AT keyboard.
- edanm 16y agoI highly recommend getting used to it. Being able to keep your hands on the home row, even on a laptop, is a huge boon; I can't really claim it's a productivity increase (I have no idea if it is), but it just feels so much better and more fun to type that way. Actually, the same is true of most vim stuff: does being able to delete text 2 seconds quicker really make you more productive? Beats me. But after you get used to being able to tell the computer what you want to happen and have it happen (e.g., delete everything inside these parentheses), using the old method of moving around the cursor just feels bad.
- samfoo 16y agoI'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'?
- throw_away 16y agoThe far better argument for not using arrows while in insert mode is that it hinders the learning of the difference between insert and normal mode. Once you get used to there being a strong difference between the two, you end up using the more useful motion commands such as f/t or ) or #/*. these motions usually get me to where I want to go faster than hjkl would, not to mention the benefits of being able to compose advanced motions and commands. When I help people learn vim, one of the first things I do is disable the arrow buttons in insert mode. I tell them that they should avoid using them even in normal mode. I feel that this crutch ends up hurting you in the end. On the other hand, writing text in non-vim contexts is maddening with all it's arrow-arrow-arrow-backspace-backspace-backspace pain. I don't see how 99% of people can stand to do it this way :)
- dhimes 16y agoHere is another good read on vi/vim. http://www.viemu.com/a-why-vi-vim.html http://www.viemu.com/a-why-vi-vim.html See "misconception #4" for this particular point.
- zephyrfalcon 16y agoThis is by far the best vi/vim introduction I've ever read. Not because it makes you instantly proficient with the editor -- there are other tutorials for that -- but because it does an excellent job explaining how to use it properly. In Vim, especially the GUI version, it's perfectly possible to just press 'i' and then putter around in your text file, moving around with cursor keys and Home/End and such, deleting, typing, and only occasionally dropping back into "command mode" (as it is often called) to delete a line, or search for something, or save the document (assuming the GUI version doesn't have key bindings set up for this already). I used Vim like this for over a decade, never really understanding the point. As the article points out, this is completely wrong. You stay in command mode (called "normal mode" here, which gives it a different feel immediately -- it's the mode you normally should be in), and switch to insert mode only to type short bursts of text. Everything else is done in command mode. While this seems weird at first, once you start getting the hang of it, it starts paying off big time. There are a zillion commands that do something and then enter insert mode. I used to think they were completely redundant; there's already 'i' and 'a' to do that, why have more? Because, obviously, when you spend most of your time in "normal mode", this allows you to execute a command and immediately start typing text. E.g. to insert a new line below the current one, you press 'o', and Vim inserts the line, indents it properly (if you have autoindent set), and is ready for typing. While this is hardly heavy wizardry, once you know a couple dozen of these commands, editing becomes a very different experience. You just move through the text differently. Anyway, the article explains this, and a lot more, much better than I can do it here. :-)
- edanm 16y agoFrom my experience, each has its own problem. While learning emacs, you're very likely to hit a few keys by accident and suddenly have a new open buffer you don't understand; it takes some time to learn to hit c-g c-g every time something like that happens (is c-g quit? I'm pretty rusty these days). Vim has other problems (like the insert mode), but even in vim you can do as the author says: always be in insert mode, and pretend it's just a normal editor.
- leif 16y agoC-g is quit. :) The difference is (full disclosure, I pray at the altar of emacs now, after many years of vi), much of vim's functionality is hidden if you stay in insert mode, while in emacs, you always have everything available to you (and in many cases, it'll suggest "next time, use this shortcut").
- lelele 16y agoOTOH, I pray at the altar of Vim while being into the church of Emacs ;-) Modal editing is unbeatable. GNU Emacs + Viper + Vimpulse is the way to go. I agree that Emacs allowing you to access commands while inserting text is nice. However, what are you doing in Insert mode? Hit Esc as soon as possible, my friend ;-)
- davidw 16y ago> However, what are you doing in Insert mode Writing things?
- lelele 16y agoYou wrote "stay in Insert mode", therefore I thought you were making the mistake of staying in Insert mode longer than needed (if I misunderstood what you meant, please ignore my rhetorical question). I didn't become proficient at modal editing until I followed the advice of staying in Insert mode as little as possible, just to enter short bursts of text (and then remapping the Esc key becomes a must).
- phreeza 16y agoCan we please not have ye olde flamewar here? Not flagging or accusing you of that being the intention btw, just saying...
- davidw 16y agoSometimes, what with all the new things these days, I think it's opportune to remind people that emacs (and... ok, I'll admit it) vim are still there and still great tools.
- SwellJoe 16y agoI always say in any text editor flame war (usually one with little kids claiming that they're more productive in their fancy-pants new mousey editor that widgets and icons and zoomy things and little colorful spinny wheels while it thinks about deep texty problems): Editing text is a solved problem. vim or emacs, pick one and get back to work.
- tomjen3 16y agoI used to believe that for a long time, but recently I have been far more productive in an ide than in Emacs. I won't run the same test with vim, because I don't think it will be much different, and the insert/command mode would drive me nuts.
- dan00 16y ago"I used to believe that for a long time, but recently I have been far more productive in an ide than in Emacs." Believe me, then the programming language is the issue, not the editor. It's especially funny, if people claim that their ide is superior, because they can automatically generate boilerplate code, but never question their programming language.
- tomjen3 16y agoIt doesn't seem to matter what language it is - the problem is that I can't remember all the valid function/class/type names and what kind of arguments they take. Autogeneration of code is nice when I write Java code, but even Haskell has a bunch of boiler plate import codes, as does Python and Ruby.