Getting VIM setup for Ruby on Rails

October 3rd, 2011 at 9:39 pm 1 Comment

I just got started using Vim for Ruby on Rails development. To me, learning Vim is like growing a garden, it doesn’t happen overnight and you have to keep working at it. Also, getting Vim setup isn’t a one-and-done activity like installing a new toilet or a traditional editor/IDE. You have to keep tweaking and customizing it. Anyway, here are some of my notes on how I got started and some quick wins. Please note that this is more of a (rough) guide on how to get Vim setup for Ruby on Rails than it is how to use it.

Get Vim

First the easy part, download and install your flavor of Vim:

Vimrc file

Now, before you start editing any files, you’ll probably want to create a vimrc file. You’ll be spending a lot of time in here, this is where most of you preferences and customizations for Vim will go. This file is like using a Vim performance enhancer. Tweaking this file will turn your normal ride into a high performance sports car. But to me, simply copying someone else’s vimrc file is like getting into someone else’s car where you have to adjust the seat, mirrors, steering wheel, radio presets, etc. because it’s customized for them, not you. And with my brief experience with Vim, it’s unlikely that you’re going to find a vimrc file that is exactly what you want. So you have to customize it. Below are some links on creating and customizing your vimrc file.

Information on the vimrc file:

More basic info:

Here’s a good thread on Stack Overflow to find good settings for your vimrc file:

You can use to handpick vimrc settings.

You can browse and cherry-pick from other people’s vimrc files on GitHub, by using a search query like this in Google: “.vimrc”

Here is an online resource for all vimrc options (which is the same as the built-in documenation):

If you want to know what a certain vimrc option does, just type: ‘:help option-name’ and it will tell you what it does and what the long and short form of the option is.

Learn more about the different key mappings:

Learn more about the <leader> character:

Set a default color scheme and font

Now that you have a basic vimrc file setup, here’s a quick and easy win to customize your Vim experience by picking a default color scheme and font.

Here are some good color themes I have found:

The color theme files go in ~/.vim/colors or ~\vimfiles\colors if you’re on Windows. Then you in your vimrc file you can set your default color scheme:

" Set default color scheme
colorscheme jellybeans

It’s also nice to have a good programming font in Vim. Here’s a list of preferred fonts and also how to set a default font in your vimrc file:

Install plug-ins

Next, you’ll probably want to install some plug-ins to add additional functionality to Vim. There are two main ways (I know of) to manage your plug-ins: Pathogen and Vundle. Personally, I use Vundle, I like how you can keep track of all your plug-ins in your vimrc file and run one command to install them all, kinda like Bundler. Anyway, here are some handy plug-ins that I have discovered so far:


Well, that’s about it. Definitely not an exhaustive guide, but hopefully it’s enough to get started. Like I said I just got started using Vim for Ruby on Rails myself, so I know there’s a lot of plug-ins and settings I haven’t discovered yet.

1 Response to “Getting VIM setup for Ruby on Rails”

  1. Rick
    November 30th, 2012 at 4:43 pm

    Hi Shaun,

    I am a Vim and Rails newbie. This is an excellent post. To the point and exactly the information I was looking for!

    Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/shaun23/public_html/wp-content/themes/shaunambrosev5/comments.php on line 42

Leave a Comment