Ⅰ. 插件描述
Navigate your Ruby projectⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'danchoi/rb-nav'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'danchoi/rb-nav'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'danchoi/rb-nav'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/danchoi/rb_nav
Ⅳ. 文档说明
# RbNav
RbNav is a lightweight Vim plugin that helps you navigate the classes,
modules, and methods in your Ruby project
[screenshots]
Benefits:
- navigate the classes and modules in your Ruby projects with less typing
- jump to methods on current page more quickly
- symbol-centric approach to navigation might suit you better than the file-centric approach
Please check out my related Vim plugin
ri.vim for Ruby
documentation-browsing features.
Prerequisites
- Ruby 1.9 or higher (tested on 1.9.2)
- Vim 7.2 or higher
- GNU grep 2.6.3 or higher (check your version with
grep -V)
Install
gem install rb_nav && rb_nav_install
This installs the rb_nav.vim plugin into your ~/.vim/plugin directory.
To upgrade RbNav to a newer version, just repeat the installation procedure.
Commands
For the all the commands below, the mapleader is assumed to be ,. If it is\ or something else for your setup, use that instead.
Invoking the plugin
,nnavigate the classes and modules in your project,,nnavigate the methods in the current file
To change these keymappings, edit the two lines at the end of~/.vim/plugin/rb_nav.vim.
CTRL-pandCTRL-nlet you navigate the drop-down matches<ENTER>selects an itemCTRL-ecloses the match list and lets you continue typingCTRL-u: when the match list is active, cycles forward through the match
list and what you've typed so far; when the match list is inactive, erases
what you've typed.
- both
TABandCTRL-x CTRL-ureactivates autocompletion if it's gone away CTRL-yselects the highlighted match without triggering ENTER
Autocompletion is case-insensitive.
You can also match a fragment. So if you want to get to UsersController, you
can type usersc and hit ENTER. This should be sufficient to bring upUsersController as long as that is the top match for the fragment usersc.
The search path
By default RbNav searches files using these grep command flags:
let g:RbNavPaths = " . --exclude-dir='\.git' --exclude-dir='vendor' \
--exclude-dir='db' --include='*.rb' "
You can override these flags by reassigning g:RbNavPaths to something else in
a .vimrc files in your project's root directory.
Bug reports and feature requests
Please submit them here:
About the developer
My name is Daniel Choi. I specialize in Ruby, Rails, MySQL, PostgreSQL, and iOS
- I am based in Cambridge, Massachusetts, USA.
- Twitter: @danchoi
- Personal Email: dhchoi@gmail.com
- My Homepage: http://danielchoi.com/software