gnu global创建索引文件时排除某些目录

软件主页:https://www.gnu.org/software/global/

GNU Global is a source code tagging system that works the same way across diverse environments, such as Emacs editor, Vi editor, Less viewer, Bash shell, various web browsers, etc.

通常来说,安装完gnu global后,进入代码工程的一级目录,执行gtags,就会生成tag索引文件。

如果我们想要排除某些目录下的文件,例如对于linux的源码工程,arch目录下不感兴趣的CPU架构类型,sound,tools目录等等排除后,可以减小索引文件的体积,使用时也会更加快捷,那么,怎么才能排除某些目录呢?

 

在代码工程的一级目录下新建文件 gtags.conf,按照如下格式编辑其内容:

default:\
common:\
:skip=/arch/m68k/: \
:skip=/arch/powerpc/: \
:skip=/sound/: \
:skip=/tools/:

这样,再执行gtags命令生成索引文件时,就会跳过 linux/arch/下m68k和powerpc目录,一级linux/下的sound和tools目录。把每个要排除的目录都写在单独的一行是为了方便修改。也可以合在一起。

参考:

skip (comma separated list)

Gtags skips files and directories which are given in this list. As a special exception, gtags collects values from multiple skip variables. If the value ends with ´/´, it is assumed as a directory and gtags skips all files under it. The value may include glob patterns (*, ?, [...], [!...], [^...]).

If the value starts with ´/´, it is assumed a relative path name from the root directory of the project. You cannot use glob patterns for a path name. However, this direction is out-of-date, and is not recommended. Instead, you can use -f option which can be combined with find(1). Since find(1) has rich options to select files, you can do everything. Additionally, this technique can also be applied to any other tagging systems like ctags(1)cscope(1), etc.

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值