Spifftastic,

 

Switching to Vim

This is part of a suggested pair of posts between me and [Ryan Burnside](http://ryanburnside.wordpress.com/), who wrote a post on [why he uses Emacs](http://ryanburnside.wordpress.com/2011/10/03/why-i-enjoy-using-emacs/). Unlike yours truly, Ryan is not an English major, so I apologize if he's missing a comma or forgets a word, but I suggest reading it as well. At any rate, I won't put words in his mouth, so you can go read it and then return for your dose of preaching to the choir, seething hatred, or usual indifference - I'm not going anywhere.

So, as the title suggests, I’ve recently made a rather large change to my usual coding workflow: I’ve begun using MacVim instead of TextMate. I use MacVim in specific, as using regular Vim in the Mac OS terminal is not the best of ideas (it works, but it’s not pleasant). I’ll try to explain why I made this jump and what exactly makes me happy to use Vim now, as opposed to one, four, six, or however many years it’s been since I first encountered Vim. However, I cannot explain why I did not use Vim all those years ago. It probably relates to it being an unintuitive editor, but more on that later.

I’m not sure how traumatic switching editors is for others - some take it better than others, some worse. You can sit me in front of the likes of, say, Emacs or Eclipse (referenced because they both begin with E and do not appeal to me1) and I will gnash my teeth and probably complain endlessly about something silly. Essentially, I’ve been hooked on TextMate for the past three years or so. Editors without the similar capabilities have not appealed to me. There is a lot to like about TextMate, but the fact is that there is one window and your code is in it; there are no distractions while coding in TextMate. Take away TextMate and I’m very unhappy.

So, I decided to take away TextMate2. That’s not entirely true, actually - TextMate has gone nowhere, but I made the conscious decision to not use it. Why? Why in the name of some deity would I ever do that when I have a perfectly fine editor already? Well, because I wasn’t comfortable with the fact that I was a one-editor person. Monogamy is pretty favorable in a normal relationship, but when you’re only really proficient with TextMate and (arguably) Xcode, something’s got to change. May as well take care of it now. It may also be an e-penis thing - it’s hard to tell from inside my own head, but I can’t rule it out. With that in mind, I’ll correct that first statement: so, I replaced TextMate with MacVim.

Now, why Vim? I’ll try to run down the reasons really quickly, with convenient bullets:

  • Vim is available on just about every platform I use. Most importantly, it’s on Mac OS and every Linux-based system, but it’s also on Windows. Windows has no shortage of decent editors, but few really stand out as great. Many of the good ones are not particularly modifiable to the extent that either TextMate or Vim is, so I can rule out a huge chunk of them based on that alone.

  • Vim is very well-documented. One would certainly hope so too, given its age. This is imperative for customizable editors, since I’m not going to sift through a ton of configuration files and guess what’s what (I’m looking at you, Sublime Text). Hell, it even comes with an interactive tutorial if you’re completely new to it.

  • Vim has reams of plugins, scripts, and so on. Again, a byproduct of its age, but also its popularity. I use a handful of plugins, and these account for any perceived deficiencies or lack of TextMate-isms in Vim. In particular, I’ll point out FuzzyFinder, Project, easytags, snipmate, SuperTab, and VisIncr as my favorite plugins.

    The same could be said of TextMate with its mass of bundles, but the aforementioned plugins tend to be more general than that. They address weaknesses in Vim. For example, easytags provides some dynamic syntax highlighting via ctags - I’m not yet aware of any way to provide something of that nature in TextMate cleanly. That’s something that allows Vim to stand out.

Overall, Vim hits at least two of the important points for any editor: I can use it anywhere and it’s highly customizable. The third important point is odd: ease of use. Despite its appearance and intimidating design, using Vim is not all that difficult, but there is the expected learning curve one gets with any new tool. It took a few hours, but I managed to get far enough past my basic understanding of Vim to feel comfortable. I went in, tore up my .vimrc, set up a lot of things specific to my working style, and pored over Vim’s help pages whenever I wasn’t sure about something. As such, the reason I mentioned documentation above is pretty simple: good documentation can flatten out a learning curve, and Vim’s thorough documentation knocks down that wall.

In many ways, my workflow in Vim feels streamlined. I don’t have to use a mouse to do anything - it just doesn’t happen. Even adding files to a project just requires I <C-w> over to my project view and type in a file name. Hell, the file doesn’t even have to exist. That’s how I create new files in my projects now - I add ‘em, open them, and begin working on them. No need to open a dialog to select anything, just get right in there and start working. This is one area where TextMate can, at times, fall short - it’s not a huge issue, but it’s odd how much I appreciate the lack of such a small nuisance.

I don’t think Vim is for everyone. This is partly because it is nerd territory. Coders are not normal people, not a single one of us, and our strange preferences just don’t apply or even matter. Vim is not an intuitive editor, not by a long shot. It is a grossly outdated tool in terms of modern user experience3 - I would be offended to see Vim forced on anyone who was not programming. Really, Vim is just an anachronism that we don’t abandon because it’s well-suited for our purposes. It works for me, it might work for you (depending on who you are), but it won’t work for sane people.

Since I started this little self-improvement attempt, I’ve become rather happy using Vim. Happy enough that I am confident that I don’t need to worry about having TextMate anymore. This isn’t to say I’m getting rid of TextMate - it still has its uses, but Vim offers me the feeling of being uninterrupted in all aspects of my work. It’s hard to beat that sensation, so I plan to stick with it for now.


  1. This is normally where I say “because they suck,” or something equally baiting, but I’ll drop the silliness and be frank: I don’t think either of these editors are bad. They clearly appeal to a wide range of programmers, developers, engineers, and what have you. So, pick what you like, how you write code doesn’t matter as long as your code accomplishes a worthwhile goal. [return]
  2. I want to be clear about something: I have no problem whatsoever with TextMate as it is. I’m in no hurry to see TextMate 2 released when TextMate already did what I wanted. The only thing I have to say to people who are currently using TextMate 1 and want to rip out Allan Odgaard’s eyeballs for want of TextMate 2 is this: shut up and get back to work. [return]
  3. The term “user experience” is something I try not to use, but it occasionally makes sense. In this case, I think it applies, given the overall experience of using Vim compared to other editors. [return]