标记文件中的相对路径

Relative paths in tag file

如果标签文件包含相对路径,Vim 会尝试相对于标签文件本身所在的位置而不是当前目录来定位源文件。 IE。标记文件必须位于 ctags -R 来自 运行 的位置。

有什么方法可以Vim 从 PWD 中找到源文件,以防我想在别处保留相同的标记文件?

您可以使用 :set tags=/path/to/your/tagfiles 从任何目录加载标签文件。

set notagrelative 添加到您的 .vimrc 文件。引用自 here:

'tagrelative' - Controls how the file names in the tags file are treated. When on, the filenames are relative to the directory where the tags file is present.