I use VIM editor for coding Ruby on Rails. I am very proud of it. I liked VIM editor when I started used it long ago. In my college we had subjects which involved writing all C programs on Linux/Unix machines. We would use VIM editor for it.  From that time, I got involved in VIM.  Actually many colleagues at that time considered it as VI editor but it was VIM(VI-Improved), the only command we typed was VI and it opens VIM on Redhat machines.

When I started my career with ROR, nearly 1 year back. I was not aware of using a specific editor for coding. I started with TextPad, everything was fine with it. Then I came to know about RadRails from my Boss (Shashank Date, he visited Rails Conf 06 and met with the guys who developed RadRails plugin for Eclipse). So I downloaded RadRails and started using it. It was buggy at that time. Many features were not working as expected. I quit using RadRails very soon and came back to TextPad.

After sometime, I was working on my first paid project. I was using TextPad that time. I found the need of a nice IDE for development as I had to navigate through many files as fast as I can. TextPad was not proving to be the best. I decided to use Eclipse with RadRails plugin this time. RadRails was more stable this time. And it proved to be the one only best IDE for Ruby on Rails.

But after some weeks, I found the need of fast editing a single file. I was tired of pressing arrow keys to navigate through file. I thought to give VIM a try. I downloaded it and started using it. I configured my vimrc for Ruby development. Initially it took some days to get familiar and have habit of using VIM to my hands. This time I used VIM a lot. Days went...

At MangoSpring, initially we decided to use common development environment. We chose Eclipse as IDE. My colleagues here were familiar with Eclipse and with RadRails, it became more easy for them. I helped to setup Eclipse for Rails development. And still all of them are using Eclipse with RadRails for Rails development. :) But I already very much addicted to VIM, I chose to use VIM as my editor/IDE.

I am not going in details of how to use VIM for editing, but following are some tips, plugins, configurations that I use for VIM as Ruby on Rails editor. Getting knowledge of these plugins and tips will help you improve typing code for ROR.

plugins that I use.

rails.vim : This plugin adds many commands and shortcuts specific to Rails development. It is one of the best VIM plugins I have found. see link for more info. It is written by Tim Pope(nice guy, helps a lot, specially you can find him in #rubyonrails and #vim irc channel on irc.freenode.net).

matchit.vim : This is a must. It helps you using % to match or traverse through if else end, ( , ), and {, }. It helps a lot. Even Eclipse with RadRails don't have such feature. :)

blockcomment.vim: select some block of code in visual model and just press .c to comment it and .C to uncomment it. Saves time.

colorschemes that I like the most.

oceandeep : If you care about eyes, you must have light dark background for the text editor.  As white background can damage your eyes. I decided to use this colorscheme as I found frequent aching of eyes due to white background. I recommend it for VIM.

vividchalk : If you are familiar with TextMate, and if you saw which theme most people use for Rails development, it is Vibrant Ink. Vividchalk is based on Vibrant Ink theme for TextMate. It's very nice to see Ruby and Rails code in vividchalk. I use it sometimes.

some configurations.

Ctags: You use VIM and you don't know about Ctags. Oh yeah, it's possible. Even I did not know about ctags for long time. Abdul told me how he uses ctags, some months back. And now I can't think VIM without ctags. I feels it should be the part of VIM setup. Ctags allows you to browse through your source code in a very efficient manner. You have to generate a tags file for your project code. And then you will be able to traverse through classes, methods, variables of your code. You just have to press Ctrl + ] on a method name and it takes you to that method. Similar for class names and variables.

vimrc: Instead of telling you, how I configured my vimrc. You can checkout latest version of it from Google code repository. It is well commented there.
You have to configure it again, as it is mostly compatible to my machine.

svn checkout http://my-vimrc.googlecode.com/svn/trunk/my-vimrc

vim-ruby gem: you can install this gem using command "gem install vim-ruby" and then you can go to the directory and run script which configures VIM for ruby development and adds some plugins (vim-ruby-install.rb). Well, It works with rails.vim plugin.

other useful links: