Search code examples
vimctags

set tags=tags in gvimrc not working, unless set it explicitly


I have a problem to set my tags file correctly. It use to work without problem after I reinstalled the system. error message like

E433: No tags file
E426: tag not found: Pids

accurs when I press ctrl+].

I have this line in my .gvimrc file

set tags=~/projectdirectory/tags

and tags-exuberant installed properly.

It works fine when I type :set tags=~/projectdirectory/tags in gvim

I also tried use set tags=~/projectdirectory/tags;/

All other .gvimrc settings function well. How this could be possible?

UPDATE:

I have solved the problem, it is because I have multiple tags setting in ~/.gvimrc, vim take the last one in current session.


Solution

  • You can check the actual effective value (after starting GVIM) via

    :verbose set tags?
    

    The option might have been overwritten by a later :set command, or a plugin.

    Even if you only use GVIM, it's recommended to put the general settings into ~/.vimrc (which is also sourced in GVIM), and keep ~/.gvimrc reserved for GUI-specific settings. An important difference between the two is that the latter is only sourced at the very end, so it's unsuitable for configuring plugins.