我正在尝试为 Python 标准库生成一个 ctags 文件,以便我可以将其添加到我的 Python 项目中,以获得标准库函数的正确标记/突出显示。我不想为变量生成标签,因为这会使标签文件变得很大,而且我真的只关心函数和类名。然而,Exuberant Ctags 似乎忽略了我所有禁用变量标记的请求,并且仍然生成一个包含大量 kind:v
条目的标签文件。
这就是我运行 Exuberant Ctags 的方式:
cd /usr/lib/python3.5
sudo chmod o+w .
ctags --languages=python --python-kinds=-vi --tag-relative=yes -f ./tags --recurse --fields=+iaSszt --extra=+q .
(请注意,我暂时将/usr/lib/python3.5 设为全局可写,以便 ctags 可以在当前目录中创建标签文件;我使用 --tag-relative 因为我想使用此标签文件使用 Vim 插件 TagHighlight)。
这里是它生成的标签文件中的一些示例行,表明它无论如何都忽略了我的选项和索引变量:
Array1Glob test/pystone.py /^Array1Glob = [0]*51$/;" kind:v
Array2Glob test/pystone.py /^Array2Glob = [x[:] for x in [Array1Glob]*51]$/;" kind:v
ArrayProxy multiprocessing/managers.py /^ArrayProxy = MakeProxyType('ArrayProxy', ($/;" kind:v
ArticleInfo nntplib.py /^ArticleInfo = collections.namedtuple('ArticleInfo',$/;" kind:v
...
Attribute inspect.py /^Attribute = namedtuple('Attribute', 'name kind defining_class object')$/;" kind:v
AttributeList xml/dom/minidom.py /^AttributeList = NamedNodeMap$/;" kind:v
AttributesImpl xml/sax/expatreader.py /^AttributesImpl = xmlreader.AttributesImpl$/;" kind:v
AttributesImpl xml/sax/xmlreader.py /^class AttributesImpl:$/;" kind:c inherits:
AttributesNSImpl xml/sax/expatreader.py /^AttributesNSImpl = xmlreader.AttributesNSImpl$/;" kind:v
作为测试,我还尝试创建一个包含“--python-kinds=-vi”的 ~/.ctags 文件,而不是在命令行上传递它,但这没有什么区别。
发生什么事了?为什么python-kinds=-vi
被忽略?
最佳答案
这是a bug Exuberant Ctag 的,您可以使用 universal-ctags相反。
此错误已被fixed在通用 ctags 中。
关于vim - Exuberant ctags 忽略 python-kinds 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46203565/