Ⅰ. 插件描述
A simple vim plugin to look for tags of specific kinds: classes, functions, etc.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'andrewradev/tagfinder-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'andrewradev/tagfinder-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'andrewradev/tagfinder-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/andrewradev/tagfinder.vim
Ⅳ. 文档说明
The purpose of this plugin is to enable searching for classes, functions or any
other language structures by their name. It expects a tag file generated by
using exuberant ctags. It's very similar to the built-in :tag command, but
with two added bonuses:
- It can filter tags by their kind (function, class, etc.).
- It opens the results in a quickfix window if there's more than one match.
The plugin defines a command, :DefineTagFinder, that lets you create a
command that does just that. The syntax is:
" in after/plugin/tagfinders.vim, for example
DefineTagFinder FindClass c,class
" or, in your .vimrc:
" first, load the plugin:
runtime plugin/tagfinder.vim
" then, define the command as before
DefineTagFinder FindClass c,classAfter this command is invoked, you can execute the :FindClass command with a
tag name, which will send you to the class if it's unique, or load the entries
in the quickfix window and let you choose between them.
:FindClass ActiveRecordEven more conveniently, the newly defined command will have tab-completion with
the tag names, so you don't have to type it all in and you can see a useful
overview of the matching classes (or functions, modules, vim commands...).
You can also define a command without providing filters for particular tag
kinds:
DefineTagFinder TagThis new :Tag command would now act like the built-in :tag command, except
it would use the quickfix window for results.
Since different file types have different tag definitions, you can override
commands per buffer by placing DefineLocalTagFinder invocations in filetype
plugins, or by using autocommands:
" in ftplugin/ruby.vim
DefineLocalTagFinder Method f,method
DefineLocalTagFinder ClassMethod F,singleton\ method
" in .vimrc
autocommand FileType java DefineLocalTagFinder Method m,methodNotice the escaped space in "singleton method". The Define commands expect
to be given two space-separated arguments -- the name and the kinds. Because of
that, the kinds themselves should have no unescaped spaces in them.
The plugin comes with no predefined finder commands. My personal preference
is to call them "Class", "Function" and so on, but you might prefer to use
"FindClass" and "FindFunction" instead. The plugin simply provides the defining
- For more information on installation and usage, please take a look at
- doc file.