vim with the rails.vim plugin

This page is under construction, so it won't be too useful yet.

vim is an advanced text editor. rails.vim is a plugin that adds functional enhancements useful for developing Rails applications.

This page is a collection of my notes on using vim with rails.vim to develop Rails applications. It is in no way comprehensive - rails.vim is very powerful. For the full documentation, type :help rails in command mode to see the rails.vim help file.

Keyboard shortcuts

This section will refer to two modes - Insert mode where you're editing the contents of a file and Command mode where you are inputting a vim command (after hitting ESC to exit whatever mode you're currently in).

The 'help_file' column shows the name of the help file that you can open for further information. Do this in command mode with :help help_file.

Insert mode

ActionShortcuthelp_file
Command completion.ctrl-x-urails-'cfu'
Open a new tab containing the closest match to whatever is under the cursor. For example, if the cursor is over a class name, this will open the .rb file that defines the class.ctrl-w gfrails-gf

Command mode

Tab completion works on these, so you normally don't have to type out the whole command.

ActionShortcuthelp_file
Open model in new tab.:RTmodel model_namerails-model-navigation
Open controller in new tab.:RTcontroller controller_namerails-controller-navigation
Open helper in new tab.:RThelper controller_namerails-controller-navigation
Open unit test in new tab.:RTunittest test_namerails-:Runittest
Open functional test in new tab.:RTfunctionaltest test_namerails-:Rfunctionaltest
Open integration test in new tab.:RTintegrationtest test_namerails-:Rintegrationtest
Note that the above commands are only a selection of those available. The full list is model, migration, observer, fixtures, unittest, integrationtest, controller, helper, view, layout, api, functionaltest, stylesheet, javascript.
Open a model's or controller's test in a new tab.:ATrails-alternate

Also see

My page on vim and gvim.

Last modified: 24/07/2007 Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top