Categories: CategoryEditor

global is an improved tag-system for c,c++,java. Works with vim and emacs.

On Debian install package global.

see: * http://www.gnu.org/software/global/global.html

Configuration file is /etc/gtags.conf.

Read the tutorial http://www.gnu.org/software/global/globaldoc_toc.html

Command line usage:

$ cd myproject/
$ gtags
$ global myFunction                       # search function
$ global -r myFunction                    # search function references
$ global -x myFuntion                     # show details

Using global with emacs:

M-x gtags-mode
M-x gtags-visit-root-dir
M-x gtags-find-tag                        # search tag, key: M-.
M-x gtags-find-rtag                       # search tag references.
M-x gtags-make-complete-list              # build completion list

type then:

M-x gtags-find-tag myFuncTAB

completes to:

M-x gtags-find-tag myFunction

M-x gtags-find-symbol                    # find any symbol
M-x gtags-find-with-grep                 # find string

To browse libraries do this:

% cd /usr/src/lib
% gtags                         <- probably as a root
% cd /usr/src/sys
% gtags
% setenv GTAGSLIBPATH /usr/src/lib:/usr/src/sys
% emacs -f gtags-mode

Use the mouse: select symbol and use mouse-3 to go to the symbol-definition.

add the following to ~/.emacs automatically load global:

(autoload 'gtags-mode "gtags" "" t)

Make some shortcuts:

(global-set-key "\C-cgS-c" 'gtags-find-tag) ;; find definition
(global-set-key "\C-cgc" 'gtags-find-rtag) ;; find references 

You can also use it with id-utils (debian package), an improved tagging system.