Yehuda Katz is a member of the Ember.js, Ruby on Rails and jQuery Core Teams; he spends his daytime hours at the startup he founded, Tilde Inc.. Yehuda is co-author of best-selling jQuery in Action and Rails 3 in Action. He spends most of his time hacking on open source—his main projects, like Thor, Handlebars and Janus—or traveling the world doing evangelism work. He can be found on Twitter as @wycats and on Github.

Everyone Who Tried to Convince Me to use Vim was Wrong

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.

237 Responses to “Everyone Who Tried to Convince Me to use Vim was Wrong”

This reflects the way that I eventually started using MacVim. Credit where credit is due: the people who did the work to make MacVim feel like a Mac app by supporting common idioms, thereby letting beginners in.

Don’t forget the dot command, i.e. repeat your last change.

Welcome aboard. :-)

I switched to Vim several years ago and yes, I have been learning it incrementally. Every day I discover something interesting and what is the most important, I can easily script it. Almost every text task is much more simple with Vim. Searching, grepping, formatting and processing is no longer pain. I cannot understand people that repeat common tasks without help of a good editor which Vim definitely is.

I’ve been thinking about learning vim but I am still suspicious if learning it will pay off later. Did learning vim really speed things up ?

I really can’t fathom these people saying you need to remap your keyboard or disable your arrow keys to make VIM useful.

I’m a longtime VIM user and somewhat of a fan, but baseline VI is awful.
VIM is VI,IMproved… Take away the improvements and I really don’t see the point. There are other more usable editors out there and mac especially has plenty.

Just knowing i to get into insert mode, escape to get out, :w to save and :q to quit and using the arrow keys is enough to get started with vim.
d is for delete, but you probably want dd to delete whole lines. there’s more power there later though, ;) 15dd will delete 15 lines, and most commands can be repeated the same way…
Then you have / to search, n for next match, and shift those to get the opposite direction (? and N), and then you start wanting to learn regular expressions to harness the real power, because the search string is actually a RegEx. :)
:/regex/command to execute a command on the next matching line, :g/regex/command to do it on all matching lines, and :g/regex/s//replacement/ for global search and replace (note that it follows the same pattern?

If you ever have to write shell scripts, regexes are really useful in tools like grep and sed, and many of vim’s commands actually come from sed through the original vi. :)

Every person has their own favourite bits of vim, but ultimately it’s there so you can tell it what to do, not the other way around. ;) Have fun, there’s a lot of power there just waiting to be discovered.

My final advice to a vim newbie would be… don’t be afraid of typing :wq into some other window every now and then. It’s geekspeak for “yeah that’s good but I’ve had enough now…”

I’m quite surprised that even though Vim is so popular, and its biggest problem is learning curve, I haven’t seen almost none interactive website for a complete beginner.

So here’s my initial attempt to provide some sort of basic help:

Hi, I like the article and agree that you have to adopt vim gradually. However, I usually recommend that you start with hjkl, a few other basics, and not live in insert mode. The reason for this is that you need to experience modal editing before you really start to see the power of vim. If you live in insert mode using the arrow keys and the mouse, it’ll take a lot longer to start to see the real power vim gives you.

I think the reason most heavy vim users suggest diving in head first is because most of the things you do in vim become muscle memory. If you start off using command-s to save and command-f to search, you are less likely to switch to the native vim commands which are in many cases more flexible.

I’m a big fan of little steps, but at least take little steps using the native commands so it doesn’t end up holding you back later.

NETHACK is the way to learn vim, Pete is definitely right here. it will teach you not only the movement keys (which do work not only in vim but many a command line program) and the vim “language”, as it d2foo means to drow 2 foo…
i used vim for a while and use emacs now. i wont go back, and i dont use any vi emulation… started using it when learning lisp via writing a nethack bot… so theres a full circle.

however dont download nethack. just telnet to and create a new user, copy over some good options file to your profile, which can be done in the browser on if you dont want to use their vi-style options editor.

also instead of esc you can use ctrl-c i think.

As someone that learned vi back in 1981 and thought it was great, I have to agree with what Robert Martin said at RailsConf this year about the people leaving TextMate and going back to editors developed in the 1970s instead of a modern IDE. In summary: it is ridiculous. When I see a young programmer using one of these old editors instead of something like Aptana Studio, or even TextMate, I wonder why they aren’t using an IBM 3270 and embedding DOS/JCL.

As for the perceived increase in productivity, I would *love* to see some actual proof of this. You may be hitting more keys, but I would wager that your actual code output is the same or lower. This is the same as team programming *all* of the actual studies that have been performed prove that it doesn’t increase productivity or reduce errors for professional programmers, but it is in fashion so people just think they have to do it. Years from now we’ll look back on all of this and wonder what we were thinking, unless we’re too busy being wrapped up in the latest fad.

I’m a hardcore VIM fan. Learned vi in University 15 years ago. I often wish I had vim bindings for just about everything that I use because once it’s in you, it’s in you like a virus. I <3 vi.

My favourite: fuzzyfinder

This was pretty much my lifecycle with vim in the beginning. I tried to use it as Textmate, got frustrated, then gave up. The second time, I learned very incrementally, trying a new command or two every day. Almost a year later after the switch, I would never go back. Vim saves me hours upon hours of time in productivity.

I like vi (it is great for editing system files) but Emacs seems to be more interesting for programming though.

I think if asked your initial question, “prove why I should learn Vi and lose a few weeks of productivity” … I would equate it to “forcing” someone to learn how to touch type on a typewriter.

It is not “instinctive” … takes quite awhile to learn and enconde memory pathways to do it (maybe a few weeks, months, etc) … but if you bother to LEARN how to touch type, your productivity over the course of your professional career would be 10-100x fold better. Over the course of your professional career, less reliance on mouse to move cursor, will also benefit RSI from using the mouse less.

For me MacVIM is absolutely essential. Secondly, I only use NERDTree in situations where I am not familiar with the structure of a project. The real magic for me is Tim Pope’s vim-rails . Being able to jump into a model simply by moving to a reference and hitting gf is pretty cool :)

Knowing how to use Vim is essential if you work on servers from the CLI at length. Vim is ubiquitous across *nix distributions and can sometimes be the only available text editor. Being competent with Vim can be the difference between spending a few minutes and spending an hour or more in a config file.

That being said, I avoid Vim on my local machine whenever possible. Textmate is more than capable of providing the functionality I need in a text editor when I’m coding.

At first, this struck me as a pretty bizarre experience. While I’ve certainly met my fair share of the immersion evangelists you describe, they seem like a minority compared to the total pool of Vim users. But then I realized most the Vim users I know are, much like myself, not really evangelists at all. I really don’t have much of a stake in what editors other people use. I’m happy to help someone that’s curious to convert, but I don’t think I’d ever challenge someone who was happy with their editor.

I’ll second the above notion that pair programming is an awesome way to rapidly learn Vim. Hashrocket was a TextMate shop when I got here.

I recently gave a presentation to my Python user group about using Vim. It can apply to other languages as well.

One thing that helped me was changed the movement to be based on visual lines instead of actual lines. This way navigating through long wrapped lines made more sense.

See the presentation here:

20 + years in and I still learn new vi/vim commands. ci was a new one to me :)

Let me just share the hint that has given me single biggest productivity increase when using vim (too bad I only learned about it after having used Vim for years!): Ctrl+[ is the same as Escape! tia.

Addendum to my last comment: of course I have the left Control and Caps Lock keys swapped :)

What was the motivation to switch, just out of curiosity? You admit that you weren’t a TextMate power user. Then you switched to vim, started learning commands, and gained a productivity boost. Don’t you think you could have skipped the switch to vim step and just started learning some TextMate commands to gain a productivity boost?

I learned vim by pair programming with a power user and running keycastr so that I could watch the keystrokes he was using to perform commands. When I worked alone, I fell back to Textmate until I was comfortable to fly solo with vim. If I’d been one of those vim users you’d talked to, I’d have strongly recommended this approach.

I’ve been a hardcore vim user for several years, and I will never go back.
I am heterodox — I don’t use the hjkl-movement keys often, and I use the mouse whenever I’m working with text that doesn’t have an easy boundary (line, word, whatever).

One of the big things that helped me past the very beginning stage was getting a cheatsheet and posting it at my desk. New commands are straight in front of you, so you don’t have to spend 10 minutes in the VimWiki to figure out what key is EOL.

My favorite is at

play with vimtutor

I love vim too… for editing configuration files on a server.

This angst about not using Vim in the comments, this is a kind of machismo applied to programming tools. Get over it already. There are better choices.

Eclipse, Ruby Mine, Aptana, IntelliJ, Visual Studio all understand by default that there are things like: projects (easy management of filesets and opening files), language semantics (autocomplete, refactoring), what a debugger is, how to integrate with version control, etc.

Or if for some reason all you do is type text all day, and all the rest of software engineering is of no use to you, there are programming editors like TextMate or jEdit that work just as well and can be just as keyboard-driven. So if you like TextMate, use it.

Seriously, No plug for Dyrek Wyatt?

Derek Wyatt’s Vim Tutorials

Vim Tips

Has some useful tips here.

From the Vim documentation:
ctrl+[ ==> End insert or Replace mode, go back to Normal mode. Finish abbreviation. Note: If your key is hard to hit on your keyboard, Train yourself to use CTRL-[

My personal recommendation is to learn how to move in VIM and know how to access the documentation (":h").

Here are the reasons I use VIM:
Marks (Local and Global)
Terse Commands
Modal Editing
Command Repeat
Move command
Ability to append what I have copied by using capitalized [A-Z]registers
Quicklists (links to compiler errors or grep search)
Column Repeat
Vimgrep (can replace with grep)
Tagging (helptags, ctags, and cscope, tags outside of C)
Help System
Split Windows (set multiple sections of same file)
Alternate File Edit (Toggle Between Two Files, ctrl+6)
Jumplist (toggle between locations in files)
Strong Undo (tree’ed)
Network Editing
Scriptable (vimscript, perl, python)
Key Remapping
Fonts import from system fonts
Project Plugin

Don’t forget to visit Derek Wyatt’s Vim page if you are new to VIM

I’ve been using Vim (and Gvim, and good old vi) for many, many years and love it. It works beautifully, a classic of the old school combined with wonderful open source creativity. Favourite command? . (repeat whatever I just did :)

If we had had this conversation, I would have suggested ‘cream’:
..or a MacVim config borrowed from cream.

Cream is essentially what you are describing; a vim configuration designed to be immediately useful to users that want common keyboard chords to work as they would expect.

I switched from UltraEdit to vim in 2004 ‘cold turkey’, turning off the arrow keys, etc, etc, and honestly it took me about a day to stop thinking about it.
I’m glad you found a way to ease yourself into it, though, and drop me a line if you ever need help with it.

Also, this is the most fantastic thing ever, and I detest using the web without it:

I know I already mentioned to you ViKing before, but I wanted to let everyone else here know there ViKing is a great tool for Vim and Mac users who want Vi-style navigation OSX.

Check it out,

I’m with Pete, here, although I’d modify the assertion to be “The best way to learn to live without the arrow keys would be to play a roguelike.” Nethack may be a bit much for a first-time user, try Rogue, (Ultra)Larn, or one of the many other simple roguelikes that use hjkl for movement.

I starting using vi almost twenty years ago (and it was the sixth editor I learned) and I haven’t looked back. I keep bouncing off of other editors, mostly because I am effectively crippled without homerow keyboard movement and basic replacement commands (*having* to grab the mouse counts as a major failure).

I’ve been loathe to offer people advice on how to learn vi-style editors like vim, other than using vilearn (for vi) or vimtutor (for vim), and getting a basic commands cheatsheet (or a vi-commands mug!). And, perhaps, to try out the :help command….

Good job on finding a way to learn Vim that works for you. And as a long-time vi(m) user, let me apologize for idiocy of my fellow users who were more interested in advocacy than effectiveness. Hopefully they’ll all read your story here, and mend their ways. :)

One of the more helpful ways I’ve found to train new people with vim is to introduce them to Vimium ( at the same time. When one gets used to scrolling up and down websites, and navigating from the keyboard in the browser, adaptation comes much quicker. The f key alone seems to convert people to Vimium/Vimperator.

I just started using VIM a couple of weeks ago and find that it is starting to grow on me. This article inspires me to not be such a VIM hard*ss and to use it in concert with my mouse. Nice idea!

To all of you VIM newbies out there who made it this far—type vimtutor into your terminal on mac OSX. This will get you started in the wonderful world of VIM!


What great memories. I first learned “vi” back in the late seventies using BSD Unix when screens were 80 chars by 25 lines and the mouse was not yet available. It’s interesting how over all these years my fingers naturally gravitate to pressing ESC and using the hjkl keys to move around. There’s that warm comfortable feeling that I nurtured early in my career that will probably never leave. Many thanks to Bill Joy for the first incarnation of vi.

Must-have for Chrom(e|ium) users: Vimium

I’ve been a long time fan of VIM but I actually come from the opposite experience. Everyone told me VIM was great so I decided to try it but did so at my own leisure. At this point, I use it for day to day editing across the board but because I never tied my hands behind my back and forced myself to use some of the more ‘hardcore’ features there is a lot of good stuff I am missing out on.

I also recommend vimtutor – probably the best place for new users to start to at least become proficient enough to test the waters. I still find as someone who has used VIM for years that I’ll rediscover stuff by occasionally running the tutor.

Nice idea. I have been trying to convince some of my coworkers to give Vim a try, but they are always put off by it. They never make it past the first week. I think I’ll introduce them to GVim (on Windows) and tell them that they should use it as they use some of the other editors. I like the idea of then introducing them slowly to the more cooler features.

Take a look at RubyMine. It won’t replace your day-to-day text editor for quickly editing config files, etc, but for large Rails projects, it’s indispensable. I can quickly follow methods between classes, gems, plugins and traverse the project effortlessly. The refactoring tools work well. It’s worth a look.

One of the larger problems is that most vim users learned vim so long ago, they’ve forgotten how they learned it. I started with it a bit in the early internet days because my ISP gave you a shell account to access your mail via PINE (yes, very early days of the internets). vi was one of the few editors available, so I used it to poke around and edit basic files. Years later, I ended up having to do some xenix work (old microsoft version of UNIX – I’m serious), and the only editor on the system was vi. It was a painful internship (and also involved writing COBOL, ick). But, by being forced to use vi, I learned quickly. The odd thing was, after I learned it and got used to it, it became second nature. Once your fingers get the muscle-memory you can work really fast.

I know I’m a happy vim user, but I don’t generally try to recruit (or convert) many others because it’s painful to start using. It’s weird, funky, and odd. And works perfectly for me.

I love vi[m] but GUI based editors can be very powerful and just as quick if they’re fully featured.

For Mac, I like Smultron, for Windows, Notepad2. Check ‘em out.

I learned vi back in college. It took me about a week to get up to the productivity level of MS notepad. After that it just keep getting better. Now it is my primary editor. vi is something you really just have to bite the bullet and give it a go. The home row arrow keys is one of its best features. To not use it and to still use the mouse is to not really use vi. Even 15 years later I am still learning better ways to do things. The more you put in the more you get out of it.

I really got into Vi(m) about 10 years ago. Now, I’m using Emacs with Viper & Vimpulse, cause there was no way I was going to use something that didn’t have Vi keybindings. I am a lisper (so there’s that), but I really love Org mode; I do most of my non-programming writing in that. Also, I have tags figured out, which is something I never got around to figuring out in Vim.

Anyway, good luck with Vi. There’s a lot you can do with it – I’ll probably be learning Vi tricks until I die.

I use VIM because that is what comes by default on most linux/solaris systems…

Due to it’s hugely useful abilities to bridge wordpad and VIM, I installed CREAM on my windows computers – this is good stuff. It doesn’t really require all of the VIM commands, but has the same abilities and more, plus the ability to either use linux-style or windows-style, and even switch text file formats back and forth with a menu option.

I love Vim but I haven’t used it for Rails dev yet. I mostly use it through ssh. My new favorite command is d/ which lets you delete from the cursor until the search string is found.

90 comments and only two of them mention Emacs? Wow! I’m not here to start a flamewar, but I find Emacs a lot more comfortable in the long run. Use CVS/SVN/GIT/whatnot with a keystroke, open a terminal with another, edit hundreds of buffers without loosing track of them, use irc in it, play tetris…and write some code now and then. Script it. Repeat.

Leave a Reply