5 ms·
After a few months of vim use, I did part of the vim tutorial using both vim and a click-and-type editor (gedit) and timed myself. Gedit was significantly fast
by astrofinch 16y ago
After a few months of vim use, I did part of the vim tutorial using both vim and a click-and-type editor (gedit) and timed myself. Gedit was significantly faster. Can't say I understand you vim fanatics.
- stevelosh 16y agoIf you say why Gedit was faster perhaps us vim fanatics can help you understand us.
- astrofinch 16y agoLet's say I need to change a word. With Gedit, I double-click the word and retype it the right way. With Vim, I press j until I'm on the line where the word is, then I press w until I'm at the beginning of the word, then I press cw to change the word, retype it the right way, and press escape to go back to command mode. Triple-clicking in Gedit highlights a line. Triple-clicking and dragging highlights a contiguous group of lines. In Vim, I'd need to move to the line I want to begin my selection on ([number]G or jjj), then press V, then press jjj until everything is selected. And I don't have to deal with the fact that the default way of deleting things overwrites the default clipboard either. I do use Vim when I need to process lines in a text document (with macros), when I'm editing files on a server, or when I'm writing a git commit message. I suppose I could use Vim in much the same way as Gedit through its mouse capability, but I dislike the lack of interface between my system clipboard and Vim's, and the fact that when I paste code in to a Vim document, the indentation gets all screwed up.
- Symmetry 16y agoGenerally, if you know where you're going its a lot faster to just start typing a search until you get to the word you want than to mess around with j and w (why incremental search isn't default eludes me). I won't claim that will always be faster than a mouse, but it should narrow the difference a lot. I totally agree with you about the clipboard issues though.
- stevelosh 16y ago"With Vim, I press j until I'm on the line where the word is, then I press w until I'm at the beginning of the word, then I press cw to change the word, retype it the right way, and press escape to go back to command mode." OK, this is something Vim people need to work on. Using j/k to move more than one or two lines is the wrong way to do things. I know, I know, we extoll the virtues of hjkl constantly, but really they're barely more effective than the arrow keys. There are better ways to move around in Vim, such as [f]orward, '[t]il and searching. In your case (changing word XYZ to something else) I would search for the word with /XY… and press return to get there, then edit as you described. "Triple-clicking in Gedit highlights a line. Triple-clicking and dragging highlights a contiguous group of lines. In Vim, I'd need to move to the line I want to begin my selection on ([number]G or jjj), then press V, then press jjj until everything is selected." See my previous comment about movement. You'd move to the line you want by using a search (or '{', which moves to empty lines), start your selection with V, and move to the end with another search (or some kind of movement command that gets you where you want to go quickly). We Vim users need to stop touting our Nethack-honed hjkl skills and start talking about Vim's better movement commands. "And I don't have to deal with the fact that the default way of deleting things overwrites the default clipboard either." Yeah, this is dumb. YankRing helps a lot by letting you 'Ctrl+P' to the right text, but I really think Vim should have a "clipboard register" that only gets overwritten when you mean it (and have other registers for the last yanked elements). "when I paste code in to a Vim document, the indentation gets all screwed up." If you're using a graphical Vim like gvim or MacVim this simply shouldn't happen. It's a bug and you could report it. If you're using the command line Vim you might need to do a bit more work to launch Vim and tell it to talk to X. It's a few extra minutes up front, but such is the price of using a terminal-based editor in a graphical environment.
- schwanksta 16y agoTo add to what Steve said, I would say: don't be afraid to use the mouse if you're in a graphical Vim. In MacVim, if I want to change a word, I'll double-click it, hit c and type whatever I want. You might say, "But you had to hit 'c' instead of just typing!" Maybe, but I could run any number of commands over that word instead of just changing it. Also, if I were in insert mode, double-clicking and typing would overwrite the word as if I were in a normal editor.
- sandGorgon 16y agoYou could use the Cream bundle for vim (http://cream.sourceforge.net/ http://cream.sourceforge.net/) to get a more modeless, Textmate-like editor.
- xtho 16y agoSince you seem to compare terminal vim vs gedit: How do you run gedit in a terminal? I gvim you could have used the mouse too.
- astrofinch 16y agoReally what I'm wondering is whether the Vim way of doing things or the click-and-type way of doing things is faster. I don't see any really compelling advantages of Vim as a click-and-type editor. Gedit also has a plugin mechanism y'know.
- mrud 16y agoYou can also use the mouse with vim. set mouse=a and the behaviour is the same, tripple click hilights a line and you can drag your mouse around to highlight a contiguous group of lines. regarding the system clipboard, yeah thats messy, but you can easily map a key to toggle the paste mode (set pastetoggle=<f11>) or get the content from the the clipboard via some keybinding (shift-F7) map <S-F7> :r!xclip -o<CR>
- bricestacey 16y agowhen I paste code in to a Vim document, the indentation gets all screwed up. Try :set paste :set nopaste :set invpaste :help paste
- mrud 16y agoUse set pastetoggle=<f11> and press F11 to toggle the paste state.
- astrofinch 16y agoThanks!
- njharman 16y agoReading your comment it is apparent you dont now "enough" vim. It has a long learning slope with many comfortable plateaus. You must be diciplined and interested in mastering your tools to push beyound these. fyi, :set paste :set nopaste
- astrofinch 16y agoIn my Vim vs Gedit test, I was doing tasks from the beginning of the Vim tutorial using the exact commands the tutorial told me to use. It does seem possible to me that someone could become faster with Vim than a click-and-type editor, but I'd guess they'd never amortize the costs of their learning. (Of course, if you're already quite advanced then you've paid a good chunk of the cost and it may make sense to continue.)
- DennisP 16y agoThe beginning of the tutorial doesn't necessarily have the most efficient way to accomplish a task. It just has the most basic way. For example: move up 10 lines with 10k. Move up 2 paragraphs with 2{. Move up to "what" with ?what, and if it stops somewhere else first, just hit n. Find the first letter T in a line with fT, and hit ; if you stopped at another one first. Etc. You can't put everything at the beginning of the tutorial but having a lot of these tricks in your bag speeds you up quite a bit. Then you start combining these movements with commands, repeating these combinations with just a period, recording them in macros with a couple keystrokes, applying them to every selected line with :norm, etc. It's the combination of all these things that makes it go fast. That said, if I've got a long distance to travel and there's no obvious movement command to get me there quickly, I'll still use the mouse occasionally. It does seem to break the flow though. The biggest improvement vim has made to my productivity isn't just the raw speed of editing, it's the fun of editing with it. That keeps me a lot more focused when the work itself gets a little mundane.
- Daishiman 16y agoNo, you would type xxg, where xx is the line number, then move with w if the word was a short distance away, or use the mouse if it was somewhere like the middle of the line, then cw. This works out favorably even a Thinkpad where I don't need to take my hands away from the home row for, and it works better when working with very large screens.
- jdietrich 16y agoApple discovered fairly early on that while using a keyboard shortcut seems faster, using the mouse is almost always quicker, even for very advanced users. The illusion stems from how we perceive time when performing the different tasks - we remember time spent searching for the correct target to click, but we forget time spent remembering the right incantation. This paradox is one of the big reasons why I don't use Vi or EMACS - I think that the productivity gains are nowhere near as great as users make out, but the sense of mastery over such arcane tools is inherently satisfying to the kind of person that spends a lot of time in a text editor. http://www.asktog.com/TOI/toi06KeyboardVMouse1.html http://www.asktog.com/TOI/toi06KeyboardVMouse1.html
- astrofinch 16y agoAfter reading that long ago, I timed myself doing keyword searches on a webpage using both cntrl-f and accessing search from the menu. cntrl-f was significantly faster.
- dasil003 16y agoThat's certainly interesting research, but it's far from conclusive. There are all manner of variables such as the accuracy of the mouse actions required, the number of keystrokes required, the familiarity of the user with the commands, and even the quality of the mouse. The tests that Apple conducted were based on simple tasks available on the Macintosh computers of the time. However, text editing is a complex task with a lot of room for optimization. There is no doubt that more keypresses can be achieved per second than mouse actions, and that if asked to repetitively perform a task that could be accomplished by means of 10 vim key strokes or some combination of 5 text selections and menu choices, the max speed of the vim'er would top out higher than the mouser. However true it is that the keyboarder forgets the time spent recalling arcane commands, it's also true that experienced vim'ers can issues multiple commands per second, some of which will do things that would not reasonably contained in a convenient location in a menu and/or icon-based interface. The powerful grammar and compositional nature of vi commands alluded to in this article, combined with the patterns that emerge in working with specific programming languages lead to opportunities to develop extremely efficient editing skills that blow a mouse-based workflow out of the water. It's not just my own experience, it's watching other people do things in vi or emacs that I guarantee are impossible with a mouse. You may well be right that the improved productivity of vi/emacs is exaggerated by its practitioners, but I don't think there's really a case to be made that advanced keyboard editing is a waste of time.
- kemiller 16y agoFew months of vim use is not really enough to see major benefits in raw speed. You have to get not just the basics but the advanced movement/replacement commands in your bones. A click-and-type editor will start you off fast and top out quickly. You can also use vim as if it were TextEdit, mostly, and the gradually add the advanced features, as per wycats. Best of both worlds.
- deleted 16y ago[deleted]
- Seth_Kriticos 16y agoI don't know how you are working and what your typing characteristics are, but you are probably not doing a lot of fast typing. Once you type reasonably fast (>30wpm), the time you have to invest to reach for the mouse, do some funky things and home back in to the keyboard is quite significant. Another thing is, that once you got some of the very useful commands into your bone, like repeat action, some of the more elaborate selections, replacing and so on, you really get much more efficient with vim. There are other advantages too. Pulling gedit through and ssh session is at best problematic, most cases there won't be an X client on the other side. You (almost) always find some kind of vi/vim there though. There are all those nice things you can do that are really use case specific, like live editing files through ftp, scripting various things that you regularly do, adapting the config file, etc.. But it's not a question of "months". Really, vim has a very steep learning curve and you have to use it on a regular basis so it gets entrenched in you. Think more about "years". But that's cool, there is always more to learn, tweak and optimize.
- astrofinch 16y agotyperacer.com says I type around 80 wpm, and I get quite nervous when I'm taking any sort of typing test, so I suspect my real typing speed is much higher. I'm on a laptop. Reaching for my mouse is very natural. I do generally use vim for editing over ssh, although since I am root on the machines I work with, I would configure Gedit to work over ssh if I did any serious remote editing.