Ⅰ. 插件描述
simple way to traverse related rails 3.1 filesⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'danchoi/rails31nav-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'danchoi/rails31nav-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'danchoi/rails31nav-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/danchoi/rails31nav.vim
Ⅳ. 文档说明
# rails31nav.vim
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.
Synopsis
To open the list of Rails files related to the file open in the current buffer:
<Leader><Leader> # Probably ,, or \\ depending on your setup
Use <C-n> and <C-p> to move up and down the selection list. Press ENTER
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:
:OP [filename]
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
(TAB || <C-n>) and (shift+TAB || <C-p>) to cycle through all the matches in the Rails directory
- When you see the matching file, press
ENTERto edit it.
So for example, if you typed :OP user and then pressed TAB, you might
see users.js.coffee as the first match. Then if you pressed TAB again, you
would see users.css.scss, and so on.
Install
Copy plugin/rails31nav.vim to ~/.vim/plugin/
Quick install:
curl https://raw.github.com/danchoi/rails31nav.vim/master/plugin/rails31nav.vim > ~/.vim/plugin/rails31nav.vim
Customize
If you want to use another key combo to open the related files dropdown, put
something like this in your .vimrc:
map <Leader>xx :call Rails31Nav_show_drop_down()<cr>
Author
Daniel Choi http://github.com/danchoi