Intro to Vim for Rails Development

Intro to Vim for Rails Development

Someone recently asked us to do “vim on Rails” screencasts.

So, we’re responding with this experiment. Let us know if this is valuable and we’ll try to improve things like audio quality.

Install thoughtbot/dotfiles

git clone git://
cd dotfiles

Installing Vim

If you’re on a UNIX machine, you probably have vi. You may also have vim. Try running vim from the command line.

Many of us on Apple laptops prefer MacVim. Download the installer.

It’s nice to have the mvim command from your shell, so copy it from wherever your downloaded MacVim to into a place where you keep scripts. I use ~/bin:

cp ~/Downloads/MacVim-7_2-stable-1_2/mvim ~/bin


The grandaddy vim plugin we use as Rails developer’s is Tim Pope’s rails.vim. Read the rails.vim documentation.

Basic commands

Move to a file in your app:

:Rmodel user
:Rcontroller application
:Rhelper navigation
:Rview sessions/new
:Rfunctionaltest sessions
:Runittest user

Go to the alternate file:


Go to the file under cursor:


Enter into insert mode:


Exit insert mode:


Open and close folded code (mnemonic is imagining the Z as tractor feed printer paper and o for open, c for closed) :

Dan Croak Developer

Walk the path of Vim mastery with The Art of Vim ongoing video series of tips and time-savers.