Posted on: 2011-01-27

One with Vim

Beware: scared of the Terminal app on your mac? Never heard of it? You can probably safely ignore this post. If, however, your life involves producing code, html, or simply writing a lot, roll up your nerdy sleeves and read on.

I can’t remember when I picked up Textmate, even though my license number’s in the low triple digits. I’ve been a happy camper for several years, mainly because there was a time (oh, the good old days) when it was frequently updated. I didn’t have split views, but I had hope – and that hope kept me going for a while.

That hope is now gone (this post is certainly not about that), and I’ve gone back to an old friend – vim. An old friend I dressed up in new clothes, furnished with bells and whistles and equipped to be generally awesome. This post guides you through doing the same. It assumes you’re on a mac, but 90% of these things will work just as well on any unix-based OS.

My MacVim setup

Installing and customizing vim:

1) You can install macvim by compiling from the source (here’s the project on Github and build instructions) or by using something like homebrew. If the two previous options don’t work for you, you can download a pre-compiled stable version of MacVim here.

2) Grab Carl and Yehuda Katz’s Janus (see their instructions). Basically, Janus is a MacVim distribution which gives you all sorts of juicy goods like NERDTree (similar to TextMate’s project drawer), great syntax highlighting color themes, fancy bindings and things like AckVim. You want this. You want this pretty bad.

3) Customize to your heart’s content. Edit your .gvimrc.local (and .vimrc.local) and add your own settings. I have customized the default font (I’m a fan of Inconsolata for monospaced code), added settings to use tabs instead of spaces for indentation, as well as some better shortcuts to split windows. My settings are on Github if you want to take a peek.

A few other resources on customizing vim:

Master your new/old tool:

Vim is an extremely powerful editor but it also takes a bit of time to get used to. There are a ton of resources if you want to learn vim (you should probably start with vimtutor, which is already installed for you – just type vimtutor in your terminal to get started).

If you prefer to learn by watching people, Derek Wyatt has a few great screencasts on vim which you can check-out here and here. There’s also a couple of Peepcode screencasts which will set you back $12 each that I’ve heard good things about too. And of course, there’s Vimcasts, which regularly updates with free screencasts on all things vim.

Conclusion:

Breathe out. Vi is certainly not for everyone, but there’s a reason why it’s been around since 1976 (vim, or vi improved was released in 1991). It’s an amazing editor, and if you care about flexibility and speed there’s virtually no competition. Feel free to tweet in thoughts and links if you have them. Now get back to your terminal window and ship something (much more on “shipping” soon).

on