gtags生成带有pygments

时间:2018-05-28 19:43:42

标签: emacs global gnu ctags pygments

我正在尝试使用pygments插件解析器在python代码库上运行gtags,但生成的GTAGS文件为空,GRTAGS引用了像“str”这样的东西,这对我来说似乎不对。

以下是.globalrc的相关部分:

default:\
    :tc=native:tc=pygments:
pygments:\
    :tc=pygments-parser:tc=htags:
我猜,

和pygments-parser非常简单。 Global是版本6.6.2。我已经读过这可能是ctags的一个问题,pygment用于定义标签,但gtags --explain没有提到ctags的任何用法 - 应该吗? .globalrc没有指定ctags的任何配置,但是通过pygments插件手册判断这不应该是必需的,因为pygments在内部使用它。那是对的吗? 可能是什么原因

1 个答案:

答案 0 :(得分:1)

我也使用global (GNU GLOBAL) 6.6.2。我没有自己的 .globalrc。以下描述的方法 /usr/share/gtags/PLUGIN_HOWTO.pygments适合我:

$ export GTAGSCONF=/usr/share/gtags/gtags.conf
$ export GTAGSLABEL=pygments
$ gtags
$ ls -Al G*
-rw-r--r-- 1 ja users  32768 May 28 22:22 GPATH
-rw-r--r-- 1 ja users 458752 May 28 22:22 GRTAGS
-rw-r--r-- 1 ja users 253952 May 28 22:22 GTAGS

完成后我可以使用gtags modeEmacs内跳转到函数定义并调用。

编辑 :我检查了一下,为了实现这一点,我需要在ctags中使用$PATH二进制文件,它也是在我提到的帮助文件中描述:

Make sure python and ctags can be invoked in your command line.
$ type python
python is /usr/bin/python
$ type ctags
ctags is /usr/local/bin/ctags