A simple Vim plugin to help you traverse related Rails 3.1 files.
For example, if you were looking at
app/models/authentication.rb and invoked
the plugin, rails31nav.vim would show you a file selection dropdown like this:
The approach here is different from the way Tim Pope's vim-rails plugin traverses related files. But you should be able to use both plugins together without conflict.
To open the list of Rails files related to the file open in the current buffer:
<Leader><Leader> # Probably ,, or \\ depending on your setup
<C-p> to move up and down the selection list. Press
to go to that file.
The selection list is also numbered. You can enter a menu number instead to open that file.
The plugin also adds a utility command that lets you open files deep within a folder hierarchy a little faster:
filename is the name of a Rails file without the path. You can type the first
few characters of the filename, and then use
TAB to autocomplete it, and then
<C-n>) and (
<C-p>) to cycle through all the matches in the Rails directory
tree. When you see the matching file, press
ENTER to edit it.
So for example, if you typed
:OP user and then pressed
TAB, you might
users.js.coffee as the first match. Then if you pressed
TAB again, you
users.css.scss, and so on.
Copy plugin/rails31nav.vim to ~/.vim/plugin/
curl https://raw.github.com/danchoi/rails31nav.vim/master/plugin/rails31nav.vim > ~/.vim/plugin/rails31nav.vim
If you want to use another key combo to open the related files dropdown, put
something like this in your
map <Leader>xx :call Rails31Nav_show_drop_down()<cr>
Daniel Choi http://github.com/danchoi