1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gtags.conf および .globalrc の読み方、書き方

Last updated at Posted at 2019-08-09

GNU global (gtags) で使われる設定ファイルの順番は以下の通り。いずれも存在しない場合は gtags 自身に組み込まれている?初期値が使われる。
https://www.gnu.org/software/global/manual/global.html#DESCRIPTION-7

gtags --config で、今いるディレクトリでの設定を見ることができる。

gtags のソースコードをダウンロードして解凍すると、トップディレクトリに gtags.conf がある。こんな感じのフォーマットで gtags の設定を行うらしい。termcap と同じような感じと書いてあるが、termcap が分からない。
https://ftp.gnu.org/pub/gnu/global/

恐らくだけれど、複数の設定をラベルとして持つことができる。初期値は 'default' で、設定ファイルには少なくとも 'default' ラベルの設定が必要なようだ(ないと怒られる)。ラベルの選択は --gtagslabel$GTAGSLABEL でできる。

default:\
	:tc=native:

tc は "他のエントリから端末の説明を読む込む" と書いてある。source とか include みたいなものだろう。
https://kazmax.zpp.jp/cmd/t/termcap.5.html

native:\
	:tc=gtags:tc=htags:

さらに gtags と htags から読み込む。htags のほうは空だった。

gtags:\
	:tc=common:\
	:tc=builtin-parser:

common と builtin-parser から読み込む。

common:\
	:skip=HTML/,HTML.pub/,tags,TAGS,ID,y.tab.c,y.tab.h,gtags.files,cscope.files,cscope.out,cscope.po.out,cscope.in.out,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,autom4te.cache/,*.orig,*.rej,*.bak,*~,#*#,*.swp,*.tmp,*_flymake.*,*_flymake,*.o,*.a,*.so,*.lo,*.zip,*.gz,*.bz2,*.xz,*.lzh,*.Z,*.tgz,*.min.js,*min.css:

common にはどんなパターンを skip するかが書いてある。
https://www.gnu.org/software/global/manual/global.html#CONFIGURATION-1

builtin-parser:\
	:langmap=c\:.c.h,yacc\:.y,asm\:.s.S,java\:.java,cpp\:.c++.cc.hh.cpp.cxx.hxx.hpp.C.H,php\:.php.php3.phtml:

builtin-parser には、どんな拡張子をどんな言語として扱うかが定義してある。

default についてまとめるとこんな感じ。最小構成で独自の設定を書きたいときはこれを真似て書けばよい。

default:\
	:langmap=c\:.c.h,yacc\:.y,asm\:.s.S,java\:.java,cpp\:.c++.cc.hh.cpp.cxx.hxx.hpp.C.H,php\:.php.php3.phtml:
	:skip=HTML/,HTML.pub/,tags,TAGS,ID,y.tab.c,y.tab.h,gtags.files,cscope.files,cscope.out,cscope.po.out,cscope.in.out,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,autom4te.cache/,*.orig,*.rej,*.bak,*~,#*#,*.swp,*.tmp,*_flymake.*,*_flymake,*.o,*.a,*.so,*.lo,*.zip,*.gz,*.bz2,*.xz,*.lzh,*.Z,*.tgz,*.min.js,*min.css:

カンマ区切りはバックスラッシュで?分けることができるみたいだ。こっちのほうが見やすそう。

default:\
    :langmap=c\:.c.h\
    :langmap=yacc\:.y\
    :langmap=asm\:.s.S\
    :langmap=java\:.java\
        :
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?