Using vim-rails to help navigate the rails project.


In the interest of being able to quickly navigate my Rails projects, I decided to dive a little deeper into the vim-rails plugin.

This helpfile describes the commands in detail, but some of the quick commands are :Econtroller, :Emodel, :Eview, which pretty reliably jump between corresponding controller, model, and view.

:Espec needs a little more help, in that you have to specify the underlying model/view/controller under test to find the correct spec file. Jumping back to the corresponding file under test is a little more reliable.

If you want to go to the new file in a split, vsplit, or new tab, you can use substitute S/V/T for E (e.g., :Sspec, :Vmodel).

This plugin may seem a bit like overkill if you already have the CtrlP working the way you want it to, but I find that I like having the more focused search functionality of a per-model/controller search and the automatic jumping from model to controller in many instances where the model and controller directories have a lot of similarly named files.


%d bloggers like this: