Search code examples
vimctags

Is there a variable I can set in the environment which will point vim to my ctags?


I know that I can run

set tags=${SOMEPATH}/tags

And that I can set ${SOMEPATH}, but is there a default path that vim is looking on when searching for a tags file that I can update without touching the vimrc?


Solution

  • The default value of 'tags' is ./tags,tags, which means Vim will search for a file named tags either in the current file's directory, or in the current working directory (:pwd).

    Modifying the 'tags' option would be the straightforward approach; this doesn't have to be in the .vimrc; you could also do this when launching Vim :help --cmd, or in a modeline inside the edited file.

    But if for whatever reason this isn't possible, the best way I can think of is to launch Vim in the directory that has the tags file, and open all files relative to that (and without :set autochdir).