Vim: Difficulty setting up ctags. Source in subdirectories don't see tags file in project root

后端 未结 5 987
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 19:25

I\'m trying to get setup with (exuberant) ctags on Vim today and am having difficulty getting it to work properly. I generate my ctags file on the command line with with:

<
5条回答
  •  孤城傲影
    2021-01-29 20:02

    There is an option to tell Vim where to look for tag file.

    I use the following configuration:

    " search first in current directory then file directory for tag file
    set tags=tags,./tags
    

    Extract from help :

    When a tag file name starts with "./", the '.' is replaced with the path of the current file. This makes it possible to use a tags file in the directory where the current file is (no matter what the current directory is). The idea of using "./" is that you can define which tag file is searched first: In the current directory ("tags,./tags") or in the directory of the current file ("./tags,tags").

    For example: :set tags=./tags,tags,/home/user/commontags

    And I keep my current working directory in the top project directory where my tagsfile is generated.

    Use :pwd and then :cd myproj (inside Vim) to go to the directory containing your tags file.

    See :help tags-option for more information on tags path.

    You issue is probably that you are either in the wrong directory, or your tags option is not properly set.

提交回复
热议问题