Gary Johnson wrote:
On 2007-03-07, Zarko Coklin <[EMAIL PROTECTED]> wrote:
Hi all!

I am trying to automate my Vim setup as much as
possible. On my PC I have 2 directories for 2
different releases.

C:\Code_Rel1
C:\Code_Rel2

At a very top level in each of these directories I
have ctags files. How can I setup Vim so that it
sources right ctags file depending from I started Vim.
For example, if I go under Code_Rel1 and in Windows
use right click to open file in one of subdirectories,
ctags should be picked up from C:\Code_Rel1 and not
from C:\Code_Rel2.

Hard coding path to ctags in .vimrc is not an option,
cause it will not work well if I right-click to open
file from another release directory.

Any thoughts on how this can be achieved?

If you don't mind adding a command to your .vimrc for each ctags file, you could do this:

    au BufRead,BufNewFile C:/Code_Rel1/* set tags=C:/Code_Rel1/tags
    au BufRead,BufNewFile C:/Code_Rel2/* set tags=C:/Code_Rel2/tags

HTH,
Gary


...and if the directory trees can have more than one level, then use instead

        au BufRead,BufNewFile C:/CodeRel1/**/*
                \ setlocal tags=C:/CodeRel1/tags
        au BufRead,BufNewFile C:/CodeRel2/**/*
                \ setlocal tags=C:/CodeRel2/tags
etc.

Notice the use of ":setlocal" to avoid clobbering the 'tags' setting for other windows opened in the same Vim instance.


Best regards,
Tony.
--
Velilind's Laws of Experimentation:
        (1) If reproducibility may be a problem, conduct the test only
            once.
        (2) If a straight line fit is required, obtain only two data
            points.

Reply via email to