Live data from Hacker News

Coming Home to Vim

stevelosh.com

81–90 of 125 posts

Re: Coming Home to Vim

#81

Earlier quoted context omitted.

"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 t…

"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." That is both slower and has the disadvantage that any intermediary occurrences of the word between my cursor and the one I want to edit will be accessed first. "See my previous comment…

I don't know about other vim-users, but I haven't run any tests because my primary motivation for using vim isn't speed (it's that vim connects with my brain and my motor activity -- it just feels "right" and I get a great flow).

Re: Coming Home to Vim

#82
post #48

A little off-topic: I love how in the side panel of the page the sub-title fades in and out as you scroll.

that's proportional to how much of the actual headline is still visible. scroll slowly and you'll notice.

Re: Coming Home to Vim

#84
post #2

One of the things I love about Vim is that every time I read though a post like this or look at someone's .vimrc I learn something new about what it can do or get another insight about how its features can make my life easier. My (semi-commented) .vimrc is on GitHub if anyone wants another example: http://github.com/samdk/vimconf/blob/master/dotvimrc I've also found StackOverflow's list of most-voted questions tagged…

Nice, I got a feeling what your main line of programming is from the source. That's somehow fun.

Anyway, might as well join in too, here is my vimrc: http://gist.github.com/144742#file_gistfile1.vim

Re: Coming Home to Vim

#85
I have nothing constructive to add beyond-- thank you Steve, what a fantastically informative post. It clearly took a lot of time and effort to put together and it is very much appreciated.

Re: Coming Home to Vim

#86

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.

I 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.

Re: Coming Home to Vim

#87

Earlier quoted context omitted.

Let'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 g…

To 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 overw…

You could use the Cream bundle for vim (http://cream.sourceforge.net/) to get a more modeless, Textmate-like editor.

Re: Coming Home to Vim

#88
post #71

What annoys me about a lot of tech blog posts like this one is that they're essentially voodoo. People like the author write instructions about what you should do without even understanding the instructions themselves. "I’m not entirely sure what the filetype lines do. I’ve read that they’re necessary and so far I haven’t had problems." His example .vimrc has filetype listed twice, which is redundant. This in itself…

I wish this post were closer to the top. Now that knowledge can finally become instantly available, it's biggest enemy is large amounts of misinformation. This is a much more effective strategy than censorship.

Re: Coming Home to Vim

#89

Earlier quoted context omitted.

Apple 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…

That'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…

Another thing that comes to mind is that using current devices (such as two 22" displays, i.e., a much higher resolution like 3360x1050), the time to do anything meaningful with a pointing-device increases, too. I, for instance, switched to a big trackball device because all this mouse lifting and re-centering became annoying.

As for the simple tasks: Something like Emacs macros enable effective processing of raw text input data--something that would take a lot longer if it had to be done manually, if possible at all.

Re: Coming Home to Vim

#90

Earlier quoted context omitted.

"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 t…

"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." That is both slower and has the disadvantage that any intermediary occurrences of the word between my cursor and the one I want to edit will be accessed first. "See my previous comment…

I tried your test, and was slightly faster at doing it vim than gedit (assuming my fingers were on the keyboard to begin with). How exactly did you do it in vim? I used the following:

y4j5jp -- yank down to 4 lines, move down to the blank line, paste after it.

I appreciate that there's an awful lot to learn before you can edit quickly in vim, and that the difference (if any) between that and gedit(or any other editor) may not be worth it.

I prefer vim for reasons other than speed, though -- the composable commands "feel" right to me, and the macro system makes short work of repetitive tasks. I'm essentially making lots of small programs to write the larger program for me.

Post reply on HN