Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A simple vim plugin to look for tags of specific kinds: classes, functions, etc.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 autoload
Octocat-spinner-32 doc
Octocat-spinner-32 plugin
Octocat-spinner-32 README.markdown
Octocat-spinner-32 _project.vim
README.markdown

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,class

After 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 ActiveRecord

Even 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 Tag

This 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,method

Notice 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 commands. For more information on installation and usage, please take a look at the doc file.

Something went wrong with that request. Please try again.