Introduction to using 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 Joe Ferris’ config files
git clone git://github.com/jferris/config_files.git
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.
Move to a file in your app:
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) :