Vim - ctags: tag not found

50,178

Solution 1

Yes, you should tell Vim where to find your tags file with something like:

:set tags=/path/to/tags

This is not very optimal, though. This line in your ~/.vimrc should help:

set tags=./tags,tags;$HOME

It tells Vim to look for a tags file in the directory of the current file, in the current directory and up and up until your $HOME (that's the meaning of the semicolon), stopping on the first hit.

Solution 2

The 'tags' variable must point to your tags file. See :help 'tags'. An example to add the path to your tags file:

:set tags+=$HOME/yourpath/tags
Share:
50,178
user16948
Author by

user16948

Updated on August 16, 2020

Comments

  • user16948
    user16948 over 3 years

    I want to use Ctags for a Zend framework project. I executed this command : ctags -R ./* ../ZendFramework/*to create a list of tags, but the problem is when I press Ctrl-] on a class or method I get this error: ctags: tag not found

    I checked the tags file and all classes/methods/variables are listed. The tags files is located in the root of the project. Should I load it manullay when I open a file?

  • crisron
    crisron over 8 years
    You might also find set autochdir useful.
  • Li Yingjun
    Li Yingjun almost 6 years
    It is very useful,Good!
  • 2.7182818
    2.7182818 about 2 years
    In my case, set tags=./tags works with vim7.x but not with vim8.0. In vim8.0 set tags=tags works.
  • linjiejun
    linjiejun almost 2 years
    :set tags=/path/to/tags work for me. I met this issue in my ubuntu16,but not in my ubuntu22
  • linjiejun
    linjiejun almost 2 years
    有效果。在我的ubuntu16上碰到过这个问题。但是ubuntu22没有,u22安装完直接使用就可以了
  • linjiejun
    linjiejun almost 2 years
    :set tags=/path/to/tags only absolute path work in this way