The switch (back) to vim

While I have to thank TextMate for being the editor that was my gateway drug into Rails (and back into programming), I kept having loads of issues with it (while I still think it’s hands down better than any of the new editors I’ve seen and much prefer it to a host of IDEs): It crashed pretty regularly, I found it slow and had to wait for it quite often, I was constantly switching between it and the command line and project searches beachballed all. the. time. I also have to admit to having had more than a little bit of guilt that I’d added yet another Mac-only title to my list of software. Somewhere in the back of my head I still keep trying to convince myself I’ll move back to Linux… someday cough. (Note that my purpose here isn’t to wail on Textmate. It is a great piece of software and I do owe it a debt. I just decided I needed to move past some of the limitations I’d been experiencing.).

But the fact is, despite removing bundles and installing fresh and saving when the application lost focus I still kept having problems. A few weeks back, a crash took a solid hour’s work with it and I wasn’t sure how to reconstruct what I’d done and I made a dark vow to switch to vim as my dev environment. I’d heard good things about the new plugins and using it as a dev environment and it is a sad thing to say that I first learned vim (well, vi) nearly 15 years ago, though I’d never say I mastered it. And since 2011 is a planned year of focus and mastery (more on that later) I decided to take the plunge (back) in.

First off, just to put yourself in the right mind frame read what the Great Yahuda has to say about his switch back. It’s true, you don’t need to be a vim jedi right away, but everyone has work to do and switching means you can’t lose too much productivity with the switch. So, that was kind of my aim. And it let me know I wasn’t navigating into dark, unknown “Here Be Dragons” territory (like I usually do).

Second of all, take a look at this fantastic blog post by Daniel Fischer on switching (published just a few days before I took the plunge). It tells you basically everything you need to know and in particular, gives you a solid idea of what you really need to do. Use MacVim, get used to the modes and use the proper plugins like the Janus set.

Armed with that, and a few screencasts (check out vimcasts.org and the peepcode vim screencast I and screencast II, I set all major source and test file attributes to MacVim and took the plunge.

I think because I’ve been using vim on servers for so long for basic editing, I’ve just gotten used to some of the commands, so the switch might have been much easier for me, but even getting back into it now has started me up with new power commands and using the plugins has actually made me far more productive than I thought I would have been almost right off the bat.

First off, speed. Vim is really fast compared to Textmate. The difference is noticeable as is general responsiveness. Don’t ask me why, but you feel more productive.

  • Fast. So fast.
  • Slice and dice uber editing through power key moves
  • Zero crashes to date (regardless of project or file size)
  • Split windows for comparing files or code
  • Working, fast project searching through Ack
  • CMD-T fast search for files (a la Textmate)

Basically, I’ve been super happy with the switch though like every change there are a few things that I’d love to sort out.

  • Would love a simple way to rename files from NerdTree rather than shelling out to the command line. One of Textmate’s best features was the double-click rename stuff.
  • Still trying to get the hang of the Rails.vim plugin and how it fits into my workflow (need a tutorial or better screencast)
  • My usual git workflow is make a bunch of changes and then git add . and git commit rather than the way Fugitive.vim works
  • Have completely stopped using tabs in favour of splits (strangely), not sure what that’s doing to my workflow though CMD-T makes it irrelevant I guess
  • Took me a while to figure out the NerdTree open/close toggle (which is awesome btw in case you didn’t know)
  • On Textmate, I really loved the Project+ bundle, and would lurv a way in NerdTree to show a file’s git status as current, untracked or changed (like the SCM badges for files that project+ has)
  • Still getting used to all the key commands - which are quite tricky to remember sometimes (though assume muscle memory will take care of that eventually)

So, if anyone has ideas for those let me know. I’ve already started modifying my .vim files (god help me) to work more the way I like.

Still, if you are thinking of making the switch, I highly recommend doing it. The drop in productivity is negligible unless you are a Textmate power user and the benefits are immediately apparent as soon as you get used to a few of the most used commands.

Happy hacking.