如何在 vim 编辑器中一次性设置 ctag

How to set ctag in vim editor one time

我已经为我的项目创建了 ctags。现在每次,我在 vim 编辑器中打开文件我设置 ctag 位置。是否可以在一些我不知道的地方设置一次 ctag 位置,这样当我从 vim 中的项目打开一个文件时,它就会开始工作,我不需要启动它命令 set tags=~/tags。 请帮忙

使用 Vim 中的 :echo $MYVIMRC 打印您的 .vimrc 文件的位置。如果未设置变量,您需要自己创建文件。通常它的位置是 ~/.vimrc,但正如评论中提到的,我的所有 Git 项目还有其他 supported locations. Once you've created the file, you can just add the command as you normally would: set tags=~/tags. As other comments mentioned, it's probably for the best to put your tags file in some constant, relative-to-the-project-root-folder place. I personally follow Tim Pope's ctags guide

我的意思是,你更喜欢哪个,

set tags=./tags

set tags=/some/project/tags,/some/other/project/tags,/yet/another/project/tags,...