Find file
Fetching contributors…
Cannot retrieve contributors at this time
78 lines (58 sloc) 2.71 KB
This plugin uses ad-hoc searches to find strings in files. For certain
languages, it can also find variable/function/class definitions,
function calls etc.
Other than |tags| or |cscope|, it doesn't build a database to speed up
searches but always scans all files. It can make use of the following
external tools in order to gain acceptable performance for medium-sized
- `git grep`
- `ack`
- `ag`
- `sift`
The builtin vimscript-based version file scanner and also
|vimgrep| are suitable for small projects. See |g:trag#grep_type| for
available options.
First, define which files belong to your project. See
|g:trag#file_sources| for available sources. If the variable contains
"vcs" and the current buffer is under control of a supported VCS, trag
will scan the files in the VCS. Maybe your project's source files are
already registered in your tags files, in which case those will be used.
Secondly, use |:Trag| to scan your project's files. You can restrict searches
to certain "kinds" like only variable definitions or only function calls. See
|trag-kinds| for details.
You can also type <Leader>r# to search for the word under cursor (see
|g:trag_map_leader| and |TragInstallMap()| for details on maps). In
supported filetypes, <Leader>rd will search for the definition of the
word under cursor.
Currently the following filetypes are supported:
- java
- javascript
- json
- make
- r
- ruby
- viki
- vim
Run `:echo globpath(&rtp, 'ftplugin/*/trag.vim')` to get a full listing
of supported filetypes.
NOTE: Some kinds are available only for a subset of known filetypes.
Default maps:
<Leader>r# ... Trag the word under cursor
<Leader>r. ... :Trag command-line
<Leader>r+ ... Show quickfixlist via |:Tragcw|
<Leader>r* ... Edit a file from the files list, i.e. the list that would be
used if no "--file_sources" argument were passed to
<Leader>rx ... The same as `:Trag -l -i=x -x=i <cword><cr>`
where x is a alphabetical letter that describes a kind in
|g:trag_kinds| and <cword> is the word under cursor.
"-x=i" (exclude commented text) is only added if kind x is
in |g:trag_kinds_ignored_comments|.
tlib ::
> git clone git://
License: GPLv3 or later
Install: See
See for related plugins.