vim启动时如何搜索标签文件并自动加载 [英] How to search the tags file and load it automatically when vim start up
问题描述
Vim是我最喜欢的编辑器,当我在vim中打开一个php或python文件时,第一个命令是:
Vim is my favorite editor, when I open a php or python file in vim, the first command is:
set tags=../../../tags
或
set tags=../../tags
我认为vim可以自动做到这一点:
I think vim can do this automatically:
首次搜索./tags,如果存在,请将其设置,如果不存在
first search ./tags, if it is exists, set it, if not exists
search ../tags,如果如果存在,将其设置
search ../tags,if it is exists, set it, if not exists
搜索../../tags,如果存在,将其设置,如果不存在
search ../../tags,if it is exists, set it, if not exists
直到到达/或D:目录
但是,我对vim脚本不太熟悉。
您的任何帮助将不胜感激!_
However, I am not so familiar with the vim scripts. Any of your help will be appreciated!_
推荐答案
在上对此特定主题有一些评论href = https://stackoverflow.com/questions/563616/vim-and-ctags-tips-and-tricks>这个问题。
基本上,这应该可以工作:
Basically, this is supposed to work:
set tags=./tags;/
它从当前目录中的标记文件开始,然后转到根目录。
It starts with a tags file in the current directory and goes up to the root directory.
输入:help标签选项
以获得更多详细信息。
Type :help tags-option
for more details.
这篇关于vim启动时如何搜索标签文件并自动加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!