折腾 sublime text 2 + ctags 为php项目添加代码跳转,生成出来的.tags文件600M多。
查看下.tags多数是压缩成单行的js霸占
ctags 可以用 exclude参数排除指定路径下或者用正则
ctags --help
....
--append=[yes|no]
Should tags should be appended to existing tag file [no]?
--etags-include=file
Include reference to 'file' in Emacs-style tag file (requires -e).
--exclude=pattern
Exclude files and directories matching 'pattern'.
....
对应到sublime就修改下 CTags.sublime-settings:
// Additional options to pass to ctags.
//
// Any addition options you may wish to pass to the ctags executable. For
// example:
//
// ["--exclude=some/path", "--exclude=some/other/path", ...]
"opts" : ["--exclude=*.js"],
但重新生成 tags,还是把js文件包含进来。 :( :(
原来 ctags 有特殊编译选项,需要 +wildcards 。
http://ctags.sourceforge.net 下载的win32版本, 是不支持+wildcards的。
$ ./ctags.exe --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Mar 13 2015, 10:35:58
Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
Optional compiled features: +win32, +regex, +internal-sort
不就一个小小的选项嘛,重新编译下ctags,但windows我安装的两个编译平台 vs、mingw 目前不能,
看源码 wildcards 功能依赖 fnmatch 函数库,而fnmatch又偏偏不支持mingw。天无绝人之路,还有cygwin。
进cygwin官网下载 https://cygwin.com/install.html ,
安装方法 http://www.cygwin.cn/site/install/
折腾最后安装好了
$ ctags --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Apr 16 2013, 08:42:49
Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
Optional compiled features: +wildcards, +regex, +internal-sort
看着 +wildcards 选项。
用sublime text 重新生成 项目的.tags文件, 从原来 600变成19M。