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
Action | Shortcut | help_file |
---|---|---|
Command completion. | ctrl-x-u | rails-'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 gf | rails-gf |
Command mode
Tab completion works on these, so you normally don't have to type out the whole command.
Action | Shortcut | help_file |
---|---|---|
Open model in new tab. | :RTmodel model_name | rails-model-navigation |
Open controller in new tab. | :RTcontroller controller_name | rails-controller-navigation |
Open helper in new tab. | :RThelper controller_name | rails-controller-navigation |
Open unit test in new tab. | :RTunittest test_name | rails-:Runittest |
Open functional test in new tab. | :RTfunctionaltest test_name | rails-:Rfunctionaltest |
Open integration test in new tab. | :RTintegrationtest test_name | rails-: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. | :AT | rails-alternate |
Also see
My page on vim and gvim.