Rails.vim is a staple of our Hashrocket workstations. It continues to surprise me.
Today I discovered the
:R (related) command, which is a counterpart to the
:A (alternate) command.
:R looks for the file related to your current buffer.
This command is sophisticated. Assuming you’re following Rails conventions for file organization,
:R over most templates will open the associated controller, with your cursor on the line where the action that corresponds with the view name (
show for a template called
show.html.erb) is defined. The same thing works in reverse;
:R over the
show method leads you back to