unite-gtags
is a unite.vim's source.
Execute global
command and display the result in Unite interface.
Install the distributed files into your Vim script directory which is usually
$HOME/.vim
, or $HOME/vimfiles
on Windows.
GNU GLOBAL (5.7 or later) must be installed your system and the executable binary global
on your PATH.
This source provides following sub commands for Unite
Unite gtags/context
Unite gtags/ref
Unite gtags/def
Unite gtags/grep
Unite gtags/completion
Unite gtags/context
lists the references or definitions of a word.
It executes global --from-here=<location of cursor> -qe <word on cursor>
When your cursor is on a definition Unite lists references of it, otherwise list definitions.
Unite gtags/ref
lists references of a word.
(It executes global -qrs -e <pattern>
in internal.)
You can specify <pattern>
as an argument :Unite gtags/ref:<pattern>
.
When exeucte this command with no arguments :Unite gtags/ref
, unite-gtags uses expand('<cword>')
as pattern.
Unite gtags/ref
lists definitions of a word.
(It executes global -qd -e <pattern>
in internal.)
You can specify <pattern>
as an argument :Unite gtags/def:<pattern>
.
When exeucte this command with no arguments :Unite gtags/def
, unite-gtags uses expand('\<cword\>')
as pattern.
Unite gtags/grep
lists grep result of a word.
(It executes global -qg -e <pattern>
in internal.)
You can specify <pattern>
as an argument :Unite gtags/grep:<pattern>
.
When exeucte Unite with no arguments :Unite gtags/grep
, input prompt is shown.
unite-gtags uses the input as <pattern>
.
Unite gtags/completion
lists all tokens in GTAGS.
It executes global -c
and show results.
Default action on the Unite item is list_references
.
list_definitions
is also available.
Set project specific configuration. Project is specified with $GTAGSROOT
if configured,
otherwise with result of fnamemodify('.', ':p'), usually current dir described as absolute path '/' added.
Following items are configured for each project:
treelize (0 or 1)
: show Unite's items in tree format or notabsolute_path (0 or 1)
: add-a
option to global command or notgtags_libpath (list of string)
: join with ':' and use it asGTAGSLIBPATH
You can set default configuration with specifying _
as project name.
Configuration Example:
g:unite_source_gtags_project_config = {
\ '/home/foo/project1/': { 'treelize': 0 },
\ '_': { 'treelize': 1 }
\ }
" specify your project path as key.
" '_' in key means default configuration.
When treelize = 1
, unite result is grouped by filepath and enable you to select a candidate with tree like interface.
This format is effective when filepath is too long string.
Default format:
sample1/foo.rb |2| def hoge
sample1/foo.rb |6| hoge
sample2/bar.rb |4| hoge
Tree format:
[path] sample1/foo.rb
|2| def hoge
|6| hoge
[path] sample2/bar.rb
|4| hoge
When absolute_path = 1
, unite-gtags
add -a
option to global
command.
Path in unite's items changes to absolute path format.
Relative path (default):
sample1/foo.rb |2| def hoge
sample1/foo.rb |6| hoge
sample2/bar.rb |4| hoge
Absolute path:
/home/foo/sample1/foo.rb |2| def hoge
/home/foo/sample1/foo.rb |6| hoge
/home/foo/sample2/bar.rb |4| hoge
When gtags_libpath
is specified with list of string,
unite-gtags joins them with ':' and use the joined string as GTAGSLIBPATH
.
(This feature is only available in *nix system.)
Example:
When configure gtags_libpath with following
let g:unite_source_gtags_project_config[<cur_dir>] = {
\ 'gtags_libpath': ['/usr/include/', '/home/foo/include/']
\ }
unite-gtags
executes global
with temporary environment variable GTAGSLIBPATH
like below
GTAGSLIBPATH=$GTAGSLIBPATH:/usr/include/:/home/foo/include/ global ...
-
uniteSource__Gtags_LineNr
Highlight for Line number (default linked to
LineNr
). -
uniteSource__Gtags_Path
Highlight for filepath (default linked to
File
).