Wikia

Vim Tips Wiki

Changes: Script:893

Edit

Back to page

(Standard format.)
(Key mapping)
 
(7 intermediate revisions by 2 users not shown)
Line 2: Line 2:
   
 
==Updates==
 
==Updates==
Updates can be found in the latest package of GNU global on [ftp://ftp.gnu.org/pub/gnu/global/ gnu.org]. It contains gtags-cscope.vim, too. --March 24, 2013
+
Updates can be found in the latest package of GNU Global on [ftp://ftp.gnu.org/pub/gnu/global/ gnu.org] (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 settings==
  +
  +
<pre>" Auto-update GTags database from current file
  +
let g:Gtags_Auto_Update = 1</pre>
  +
==Key mapping==
  +
<pre>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></pre>
  +
  +
==Known issues==
  +
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: http://lists.gnu.org/archive/html/info-global/2011-09/msg00000.html
   
 
==Comments==
 
==Comments==

Latest revision as of 22:34, May 18, 2014

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 vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

UpdatesEdit

Updates can be found in the latest package of GNU Global on gnu.org (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: http://lists.gnu.org/archive/html/info-global/2011-09/msg00000.html

CommentsEdit

Around Wikia's network

Random Wiki