« Rails environment sanity | Main | First Post »
Thursday
Mar262009

Jumping ship. Moving from Textmate to Vim for Rails development

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.

  1. First, I use a Mac so MacVim is a must. You can get MacVim here.

  2. 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…

  3. 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.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (1)

I'd recommend checking out this script for snippet bundles similar to textmate. I find it pretty invaluable. Also have a look at scrooloose's (NERDTree author) snippets directory here which is pretty good.

Whilst I'm here, I'd also highly recommend these few plugins too.

September 1, 2009 | Unregistered Commentervesech

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>