Jumping ship. Moving from Textmate to Vim for Rails development
Thursday, March 26, 2009 at 9:39PM Background
For the last two years or so I’ve been using Texmate for almost all of my Rails development. When I first started with Rails it was the recommended editor to use and much cheaper than the alternative (BBEdit). I purchased my copy and started hacking away. Even though Textmate met most of my needs I experimented with RadRails (now Aptana), Komodo, and Textpad (on Windows) and none of them had the simplicity, flexibility, or ease of use as Textmate. Recently I’ve noticed that there has been a fall off in Textmate development (version 1.5.8 was release sometime in February, prior to that version 1.5.7 was released in October of 2007!). Not that this is a huge problem, but with the textmate feature request as long as it is I would hope that the developer would be more on top of things.
Why the switch?
After much consideration, I decided to give Vim a try. Part of my reason for a switch in text editors was because I was looking for what would be the the “samurai sword” for software development (if there is such a thing). The other part of the reason why I started looking for other text editors was the ability to open two files at once. While this may not seem like a big deal to most people, I am tired of cmd-T’ing between my models and my spec files, my css and my views, my models and my migrations, etc… Perhaps it’s my development style or lack of short term memory but having to toggle between two files was beginning to wear on me and my productivity.
Why Vim?
Well, it helps that a developer I work with is a Vim guru. Also, (on his recommendation) I started using a Firefox plugin called Vimperator. This is a cool tool that is like a Vim gateway drug. It removes almost all interface elements in your browser and allows you to interact with web pages like they were files in Vim. It’s totally sweet. Being able to browse the web without your mouse is more awesome than you can imagine!
After using Vimperator for a while I started to become comfortable with how to use Vim. I had learned some of the commands to navigate. I was ready to make the plunge into Rails development in Vim.
How to do it
I’m not going to get into how to use Vim. There are far better sites out there for that purpose. Here are some of the add-ons for Vim I recommend to make the transition from Textmate to Vim easier.
First, I use a Mac so MacVim is a must. You can get MacVim here.
Once you’ve got that installed get the Rails script utility to make your Vim Rails aware. It will make it easy to switch between related files, run rake tasks, etc…
To get the nice tree project gutter that Textmate has there is NERDTree. Using the same commands for navigating vim you can navigate your project files with ease.
One last tip… Vim (and other advanced text editors) have a lot of sharp edges. One which cut me was the caps lock key. Caps lock is a pretty useless key. I’m not sure how it ended up on modern computers. Perhaps so people can unleash the fury?! Anyway, there is this neat program called PCKeyboardHack that will allow you to remap your caps lock key to esc which is great for Vim because the esc key is vital to Vim usage.
The old (and busted)

The new (with teh hotness)

Hope this post helps with your Textmate to Vim conversion. It takes sometime to make the transition but it’s worth it. I’ll post more tips when I have them.
Jamis Buck wrote a more detailed account of moving from Textmate to Vim that includes a way to get CMD-t type file browsing in Vim. http://weblog.jamisbuck.org/2008/10/10/coming-home-to-vim
It looks as if FuzzyFinder and Jamis’ plugin are not playing nicely together. See http://weblog.jamisbuck.org/2009/1/28/the-future-of-fuzzyfinder-textmate for details if you’re going to use FuzzyFinder with the Vim.
Another article about using Vim for Rails development. A bit dated but covers the basics of some useful plugins.
http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies
Textmate,
VIM,
development,
programming,
rails | in
Programming 