set tags=tags;D:/Shared
means "look upward for a tags
file from the current directory until you reach D:/Shared
".
If you work in project C on disk 2 (let's call that disk E:
), Vim will never visit D:/Shared
because of two things:
Upward search is not recursive.
If no
tags
file is found at the root of the "current directory", Vim tries to find one at the root of its parent and so on until it reaches the topmost parent or the directory you specified after the semicolon. So, supposing you are editingE:\ProjectC\path\to\some\file
, you can't expect Vim to find atags
file outside of that path. Vim will search for the followingtags
files, sequentially and, by the way, never find that hypotheticD:\Shared
:E:\ProjectC\path\to\some\tags <-- KO E:\ProjectC\path\to\tags <-- KO E:\ProjectC\path\tags <-- KO E:\ProjectC\tags <-- OK! E:\tags <-- KO
It won't find any
tags
file not listed above.Windows doesn't have the equivalent of UNIX's "root" directory anyway.
When you don't specify a stop directory, upward search climbs the inverted tree of your filesystem from the current directory (or an arbitrary start directory) to the root of the filesystem.
Supposing you are still editing
E:\ProjectC\path\to\some\file
, upward search will ultimately look for the stop directoryD:\Shared
directly under every parent directory in the path toE:\
and will rather obviously never find it.
If you want Vim to find D:\Shared\tags
wherever you are, you only need to add it explicitely to the tags
option. Not as a stop directory but as a specific location:
set tags=tags;,D:/Shared/tags
Now, it says "look upward for a tags
file from the current directory and use D:/Shared/tags
".
Hmm… that was a lot of words just to explain the need for a single ,
.