Yehuda Katz is a member of the Ruby on Rails core team, and lead developer of the Merb project. He is a member of the jQuery Core Team, and a core contributor to DataMapper. He contributes to many open source projects, like Rubinius and Johnson, and works on some he created himself, like Thor.
Everyone Who Tried to Convince Me to use Vim was Wrong
July 29th, 2010
A couple weeks ago, I took the plunge and switched to vim (MacVIM, to be precise). It wasn’t the first time I tried to make the switch, and I had pretty much written it off entirely.
Why? Because the past few times I tried switching to vim, I took the advice of a master vim user, and quickly sunk into the quicksand of trying to learn a new tool. In every prior attempt, I gave vim a few days before I gave up. And every time, I managed to get virtually no work done the entire time, spending about 90 percent of my day fighting with my editor (a more charitable way to put it would be “learning my editor”).
Invariably, the master vim users that were helping me make the switch would encourage me to stick it out. “If you just give it a few weeks, you’ll never want to switch back.”
The trouble was, I had work to do. I could only switch editors if the new editor did not significantly impede on my day-to-day work. I can already hear the responses: “That’s simply impossible. It’s a new editor designed for advanced users. You’ll just have to put up with the pain until you get used to it.”
Here’s the thing, though: I didn’t really have to put up with a huge amount of pain when switching to Textmate for the first time. In fact, it was downright pleasant.
The last few times someone tried to get me to switch to vim, I issued them a simple challenge. Can you tell me a way to switch that will not significantly reduce my productivity for the first few weeks. It wasn’t a challenge that was intended to fully shut down discussion. When I really thought about it, Textmate wasn’t doing all that much for me. It was a glorified Notepad which had working syntax highlighting and understand where to put the cursor when I hit enter (most of the time).
I don’t actually use “snippets” all that often, or all that many “commands”. I don’t mind the extensibility of Textmate, but I’m not a hardcore Textmate hacker myself, meaning that I’m ok with any editor that has the same level of extensibility that Textmate has (namely, all of them).
Despite what I considered a relatively reasonable request, my challenge was met with disdain and even anger by most of the people I talked to. “If you feel that way, Vim probably isn’t for you.” “You’re learning a new EDITOR for God’s sakes. Of COURSE there’s going to be a learning curve.”
I had written off the entire sorry affair.
A few weeks ago, Carl told me that he was playing with Vim. His explanation was that he had seen a number of people be really productive with it, and he was curious. Carl is definitely willing to put up with more pain to learn something new than I am, so I issued the same challenge to him.
Perhaps because he wasn’t steeped in hardcore vim hacker lore, he didn’t angrily dismiss the entire premise of my question. Thinking about it a bit more, I realized that most of the people who had tried to get me into vim had suggested that I dive in head first. “First thing: turn off the arrow keys.” “Don’t use the mouse. Force yourself to use the keyboard.”
Carl convinced me to use vim for the first couple of days pretty much exactly as I use Texmate (with the exception of having to switch between normal and insert modes). I installed NERDTree on MacVIM, grabbed the most common vim “packages”, and was off to the races. (I should note that I installed topfunky’s PeepOpen, which definitely helped with a very common workflow that I find it hard to live without).
For the first day, I clunked around by using my mouse’s scroll wheel, clicking and highlighting things, and spending most of my time in insert mode. It was slightly less productive than Textmate, but mostly in the range of what I’d expect switching to a new tool. In short, while I felt a bit out of sorts, I was able to get plenty of work done that first day.
As the days went on, I learned a few commands here and there. The first big one for me was ci as in ci " (it means: replace what’s inside the next set of " and go into insert mode). This singlehandedly made up for most of the productivity losses I was feeling from learning a new tool. Throw in o, O, A, :N and /search and I was already quite a bit more productive than I had been in Textmate.
Sure, I’m still plodding around in some cases, but only a handful of days later, using Textmate for anything feels clunky (most commonly, I try to use o or O to insert a new line above or below the one I’m currently on).
I was able to get here because I used my mouse wheel and button, arrow keys, apple-f to find text, apple-s to save files, and a whole slew of other common idioms, instead of grinding to a halt and trying to switch all of my practices at once.
To those who would say “that’s obvious; of course you learn vim incrementally”, I would simply say that having spoken to a number of vim users in the past, I never got that advice. Instead, I got a lot of advice about turning off my arrow keys, disallowing the use of the mouse, and learning the (MORE EFFICIENT!!!) vim ways to do everything, all at once. People just couldn’t stomach the idea of me continuing to use an outmoded practice (like apple-f) when vim had much better tools available just a (huge volume of) memorization away.
To those who are considering using vim, my recommendation is to use MacVIM, NERDTree, PeepOpen (or command-t), and use the mouse, arrow keys, and familiar OSX’isms all you want. Very quickly, it will become obvious that there’s a better way to do all kinds of things, and you can pile on the newly found efficiency once you’ve successfully made the switch without losing the ability to do work in the short-run.

Ala'a, Posted November 28, 2011, 1:26 am
Good idea to leave it while taking your first baby steps in Vim.
You can achieve that with (rather than starting vim and hitting ‘i’):
set im
or
set insertmode
C-L to leave insert mode and C-o to execute a command
drj, Posted December 12, 2011, 2:50 pm
When learning vim, the best thing one could do is print out a vim cheatsheet, and keep in handy every time vim is open. Find a cheat sheet with all the basic commands… once you get most of those down, go find a cheatsheet that has more advanced commands, or commands that you havent yet committed to memory, and continue on in that fashion, till you achieve vim ninja status.
Also download other peoples vimrc’s… many coders put them on github these days.
Keep a browser window open too, to stackoverflow…. lots of great vim tips there.
Mark S, Posted December 15, 2011, 4:36 pm
i’ve been using emacs for over 25 years, so the comments about muscle memory are important: the keybindings might be weird (though you can change them if you’d like) but they work for me. in fact, i don’t really think about them anymore…i just edit. i’m sure the same is true for vim experts.
i really, really doubt i’d become more “efficient” if i switched to vim. or anything else, for that matter.
Chris Jones, Posted December 20, 2011, 10:05 pm
@drj: Cheat sheets is the worst possible way to learn Vim. It’s a bit like folks who try to learn a foreign language with flash cards. Ten years later, they know all the stuff on their flash cards alright, but they still can’t speak the language. Learning an editor is all about committing short sequences of commands to muscle memory in order to perform editing tasks (deleting a word, reordering sentences, cutting and pasting, etc.) QUICKLY and EFFICIENTLY, without having to THINK about it.. so you can focus on what you’re coding, writing… etc.
Cody Johnston, Posted January 4, 2012, 8:54 pm
@Chris Jones: I’m sorry to be the guy that has to do this, but you need to take a step back and realize that you sound like one of the “vim masters” from the article. I was once feeling the EXACT pains Yehuda described (probably the same ones drj once felt too), and you are pretty wrong about your statement. The fact is, when you’re learning something new, you have to use whatever works for you, and cheat sheets, despite your bible-thump, can be instrumental in learning a new tool like VIM. You can’t “QUICKLY and EFFICIENTLY” learn a new thing if don’t have mental sight of how to accomplish your goal. One does not simply commit everything to memory at first glance, sir. I had this set to my background the whole time I was learning VIM and it turned out great: http://www.viemu.com/vi-vim-cheat-sheet.gif