Live data from Hacker News

Two Simple Steps Helped Me Learn Vim

adamdelong.com

71–80 of 92 posts

Re: Two Simple Steps Helped Me Learn Vim

#71
post #17

The biggest thing that helped me to learn to use vim fluently by building up muscle memory (and making commands automatic) was playing Vim Adventures, a browser based adventure game that gradually teaches you vim commands: http://vim-adventures.com/ I haven't tried the full (paid) version yet, but the demo was enough to get me moving around text quickly. Now I finally understand why people use this crazy thing. :) Al…

The biggest thing that helped me was when I realized that it actually all makes sense.

Every time you use vim and catch yourself repeating a command over and over (x, dd, hjkl) take a moment and think about if there is a more efficient way to do it by combining the commands you know.

Let's say you need to delete everything from you current cursor position to the next paren in the current line, ok you know that:

t -> move till char x in the current line

T -> move till previous char x in the current line

d -> delete

so you can combine that to:

dt( -> delete everything till next ( in line

Delete 10 lines, instead of 10 times "dd" you can just do: 10dd

Go from line 0 to line 20, instead of pressing j 20 times: 20G

Delete from current position to line 20: d20G

These are all really simple examples, but once you get the hang of it you move on to more complex stuff in no time, and you probably won't even have to look it up, it will just make sense.

Re: Two Simple Steps Helped Me Learn Vim

#72
post #56
post #24

A more elegant solution than a notecard may be using a vim cheatsheet wallpaper, like this: http://vimfoo.com/2012/09/vim-shortcut-wallpaper/ The downside of that is that it isn't customizable, so I get why he likes the 3x5 card. But at least you can't lose this.

"Awesome! With my vim cheat sheet wallpaper I will never forget anything ! This time next year, Rodney..." "Oh..."

Konsole with transparent background or set the wallpaper as background...

Re: Two Simple Steps Helped Me Learn Vim

#73
post #17

The biggest thing that helped me to learn to use vim fluently by building up muscle memory (and making commands automatic) was playing Vim Adventures, a browser based adventure game that gradually teaches you vim commands: http://vim-adventures.com/ I haven't tried the full (paid) version yet, but the demo was enough to get me moving around text quickly. Now I finally understand why people use this crazy thing. :) Al…

I turned my junior engineer colleague with zero vim experience on to Vim Adventures last week. She took to it right away, got up to level 12, and taught a class at our hackersspace on intro to vim last night, during which I learned a bunch of new commands myself. Vim Adventures is fun and vastly more engaging than vimtutor - well worth the price.

Re: Two Simple Steps Helped Me Learn Vim

#74

I found Anki / spaced repetition helpful when learning (still learning, always learning) Emacs. I make cloze deletion cards for the commands and their explanations.

Agreed. Especially for the more advanced or less commonly used vim/ed shortcuts, adding them to my general Anki deck was invaluable. I went through "Practical Vim" by Drew Neil and added all the useful shortcuts to the deck, and whenever they would come up for review I would also try my best to put them to use that same day. The card format would be question/answer e.g. "how do you split a window vertically?"

I also used this approach to familiarize myself with the various unix tools I don't necessarily use daily (sed, awk, etc)

Re: Two Simple Steps Helped Me Learn Vim

#75
Vim's usefulness comes from the combined effects of many Vim commands, also the benefit of a unique way of doing things. Sadly this combination is hardly available after only a few hours or a day's study. Knowing only a few commands won't give you much reward, and without immediate reward, people often lose motivation to continue.

IMHO a good approach is to devote one or two months' available time, make yourself super focused, just read, memorize and practice, whenever and wherever you can. Also try not to use Vim for actual work in this stage. Practice a lot with small scripts.

After a month or two of violently focused study/practice, you will either stop for whatever reason (that's OK because the knowledge gained will be useful for the rest of your career), or you have become good at 30 or 40 Vim commands/options/tricks, the combination of them actually make you more productive than before. The reward is sweeeet, so the learning goes on, probably for many more years.

Re: Two Simple Steps Helped Me Learn Vim

#76
I used vim for a long time on servers, and only there to make quick edits and wasn't very good at it.

I bought a new laptop recently and just didn't install any text editors. I had a deadline a month away and a project where I was familiar with the existing technologies.

That motivated me enough.

Add a bit of vimgolf and a lot of googling and here I am using vim for everything, everywhere. I occasionally catch myself writing emails in vim and then just copying them into Mail before I fire them off.

Re: Two Simple Steps Helped Me Learn Vim

#77

Interesting post! I found another way to improve my vim skills and memory was to simply write a wiki page with all the shortcuts / key strokes I learned or used. It has a big benefit for me of anchoring things in my memory. Always having it open when in vim, referring to it often, adding things, moving things, reorganizing categories was a huge benefit for me. Here is a screenshot of my wiki page index: http://imgur.…

Would you be willing to share the HTML for your wiki page? Just looking at the table of contents, it seems really useful for those of us trying to learn vim compared to the normal cheat sheet that looks like a periodic table...

Sure! Here it is:

http://pastebin.com/BbJv6sWX

It's raw HTML, sorry for the format :)

Note that I have the same kind of stuff for everything linux related:

http://imgur.com/fI12YY5

Re: Two Simple Steps Helped Me Learn Vim

#78
I went the flashcard route, but used Wunderlist instead. I would look at it at night before bed, and in the morning right after I woke up. Using this technique I felt totally proficient after about a month, with the ability to get work done after about a week.

Re: Two Simple Steps Helped Me Learn Vim

#79

Time and again, these "how to coerce yourself into learning this hostile tool called vim" posts appear. I read them, and it sparks my interest. But usually, whats missing is part 2, which goes: "... and this is why it was so totally worth it". An no, just because it works over SSH and is installed on every server is not quite sufficient. Also, are you programming in a script language or a .NET or JVM behemoth?

It's worth it for the same reason dvorak is worth it (to those who master it.)

Mandatory XKCD: http://xkcd.com/561/

Re: Two Simple Steps Helped Me Learn Vim

#80

Earlier quoted context omitted.

Interesting - so IDE + Vim mode would be the best of both worlds. Do you find there is a lot lost in translation, or does that feeling carry over well? I'd be especially interested in Emacs and IDEA.

I've typically found that vim impersonations miss at least a couple features that I use regularly. I've heard that Evil, in particular, is pretty complete though.

Evil is the first Vi/Vim emulation package that didn't frustrate me pretty intensely with things that didn't quite work as expected coming from Vim.

However, it doesn't attempt to turn Emacs into Vim, it's more like it gives Emacs an acceptable Vi interface for the places where that matters.

As a result, if you are using both Vim and Emacs contemporaneously, it's still easy to develop habits in one, that will cause you pain in the other.

For example, because Evil still allows you to do a lot of Emacs shortcuts, and because :q kills Emacs if there's only one window open, I find myself doing C-x k a lot to git rid of buffers.

However, that causes huge pain when I accidentally do that when I'm back in Vim. Instead I should really get in the habit of using :bd to get rid of buffers, but that's one aspect of Vim that I've never fully moved to from using naive vi style :q.

Post reply on HN