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.
git clone git://github.com/jferris/config_files.git
cd config_files
./install.sh
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:
:Rmodel user
:Rcontroller application
:Rhelper navigation
:Rview sessions/new
:Rfunctionaltest sessions
:Runittest user
Go to the alternate file:
:A
Go to the file under cursor:
gf
Enter into insert mode:
i
Exit insert mode:
esc
Open and close folded code (mnemonic is imagining the Z as tractor feed printer paper and o for open, c for closed) :
:zo
:zc