After generating with ctags -R, you must manually execute set tags=..../tags every time you enter VIM editing. I thought of a way to use ctags -f to put the tags file in the specified place, and then set set tags=.... in vimrc. Finally, I found that the tags file can indeed be found, but when jumping, it is based on the tags file. It comes from the root directory, not the project root directory. Is there any way to avoid setting tags every time?
You should just specify the generated file path when executing the ctags command.
This is how I set the
tags
options:In this way, if you are not too deep in the project, you can always find the tags file of this project.
PS: taglist and tagbar plug-ins are very useful =w=
In addition to setting
" set tags+=./../tags,./../../tags,./../../../tags
, you can try the following methods (for example, if the kernel tags are too large, it is best not to load them automatically, so it is not recommended to do this when the project is particularly large)vim automatically searches for upper-level directories and recursively loads ctags and cscope
The original text is here, I increased the number of directory levels and added GTAGS (refer to GNU golbal)