LoginSignup
2
1

More than 3 years have passed since last update.

GNU GLOBAL(gtags) セットアップ

Last updated at Posted at 2019-05-05

GNU GLOBALのセットアップ方法をメモする。

GNU Global(gtags)とは

複数のソースファイルから関数や、変数の定義元/参照元を検索、移動することができるツール
https://www.gnu.org/software/global/global.html

インストール

環境
ubuntu18.04
amd64

$ sudo apt install global_6.6.2-1_amd64.deb
$ global --version
global (GNU GLOBAL) 6.6.2
Copyright (c) 1996-2017 Tama Communications Corporation
License GPLv3+: GNU GPL version 3 or later <http://www.gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

vimプラグインとして入れる

(ⅰ) NeoBundleを使わない方法

$ mkdir ~/.vim/plugin
$ cp /usr/share/vim/addons/plugin/gtags.vim ~/.vim/plugin

(ⅱ) NeoBundleで入れる方法

NeoBundle 'vim-scripts/gtags.vim'

vimの設定を少しカスタマイズ

Gtagsで検索結果が複数ヒットすると、QuickFixリストで一覧表示してくれる。
Quickfixリストの操作を簡単にするために、とりあえず次の設定を.vimrcに追加した。

QuickFixリストにジャンプするキーバインドを追加

nnoremap [o :copen<CR>

QuickFixリストからファイルがオープンされたら、それをタブで開くようにする設定

set switchbuf+=usetab,newtab
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1