Vim Tips Wiki


1,614pages on
this wiki

Use this page to discuss script 893 gtags: integrate GNU GLOBAL source code tag system with Vim

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.


Updates can be found in the latest package of GNU Global on (really easy to compile). It contains gtags-cscope.vim, introduces :GtagsUpdate and g:Gtags_Auto_Update along with other slight improvements. --May 15, 2014

vimrc settingsEdit

" Auto-update GTags database from current file
let g:Gtags_Auto_Update = 1

Key mappingEdit

command! GtagsGuide             ! info global
" Command to print GTags settings from ~/.vimrc
command! GtagsSettingsPrint     ! echo -e "\nGTAGS.VIM SETTINGS\n" && grep -i "gtags\|gozilla" $HOME/.vimrc
" GTags and htags Update
command! GtagsUpdateAll         ! global -v -u && htags -v && echo -e "\nGtags and Htags updated."<CR>
nmap gtu                       :! global -v -u && htags -v && echo -e "\nGtags and Htags updated."<CR>
" GTags Find definition or reference of object under Cursor (depends on the context, see $ info global )
nmap gtfc   :GtagsCursor<CR>
" GTags Find Reference to object under cursor
nmap gtfr   :Gtags -r<CR><CR>
" GTags List tags from current file
nmap gtl    :Gtags -f %<CR>
" GTags List all *.c files
nmap gtlc   :sp<CR> :Gtags -P \.c$<CR> :q<CR>
" GTags List all *.h files
nmap gtlh   :sp<CR> :Gtags -P \.h$<CR> :q<CR>
" GTags Grep
nmap gtg    :Gtags -ge<Space>
" GTags Grep among Filenames
nmap gtgf   :Gtags -P<Space>
" GTags Grep for word under Cursor
nmap gtgc   :mat Search /<C-r>=expand("<cword>")<CR>/<CR>:Gtags -g<CR><CR>
" Open GOZilla 
nmap goz    :! gozilla HTML/index.html<CR>

Known issuesEdit

While error message says 'requires GLOBAL 5.7 or later', it's actually 6.0. Error is caused by parameter --result=ctags-mod and it's introduced since 6.0. -- reference:


Around Wikia's network

Random Wiki