- 海之寻趣
- Ranler
- 2016-04-29 09:28
- CC BY-NC-SA 3.0
GNU Global: Code Browser
GNU Global is a great code browser.
1. Install
Please install lastest version global-6.5 from source code.
2. Quick start
$ cd kernel
$ gtags -v # make tag files: GTAGS,GRTAGS,GSYMS
...
$ global
Usage: global [-aGilnqrstTvx][-e] pattern
global -c[qrsv] prefix
global -f[anqrstvx] files
global -g[aGilnoOqtvx][-e] pattern
global -I[ailnqtvx][-e] pattern
global -P[aGilnoOqtvx][-e] pattern
global -p[qrv]
global -u[qv]
$ global -s main
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
drivers/scsi/aic7xxx/aicasm/aicasm.c
drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c
drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
3. Code Browser in Web Browser
$ htags --suggest # make hypertext: HTML/
Then add HTML/
folder into web server(apache/nginx).
For dynamic searching in browser, we could configure web server CGI to HTML/cgi-bin
folder with -f
parameters of htags
.
4. Support more languages
Using Pygments Plug-in Parser for GNU GLOBAL, global could parse other language by symbol match(no semantic understanding).This plugin is now bundled with GLOBAL-6.3.2 or later, but we should change the default configure through ~/.globalrc
file, as mention in project page.
5. Interactive with Emacs
Using ggtags or emacs helm gtags.
For example, press M-x helm-gtags-mode [RET]
to enable minor mode:
Key | Command |
---|---|
C-c h |
helm-gtags-display-browser |
C-c C-] |
helm-gtags-find-tag-from-here |
C-c C-t |
helm-gtags-pop-stack |
C-c P |
helm-gtags-find-files |
C-c f |
helm-gtags-parse-file |
C-c g |
helm-gtags-find-pattern |
C-c s |
helm-gtags-find-symbol |
C-c r |
helm-gtags-find-rtag |
C-c t |
helm-gtags-find-tag |
C-c d |
helm-gtags-find-tag |
M-* |
helm-gtags-pop-stack |
M-. |
helm-gtags-find-tag |
C-x 4 . |
helm-gtags-find-tag-other-window |