On Thu, Jun 11, 2009 at 3:58 AM, Peter wrote:
>
> Hi,
>
> I'm looking for a way to make vim to update positions of tags in a
> file while the file is edited.
> When I have a file like:
>
> line1 see line3
> line2
> line3
> line4
>
> ... and a tags file generated with symbols for line[1-4]. Each tag
> pointing to the line it is located at. When I press Ctrl-] on line 1
> when on the text "line3". It positions me correctly to the line 3. The
> problem is that when I edit the file and add a line between line 1 and
> line 2. Let's say I get a file like this:
>
> line1 see line3
> line1.5
> line2
> line3
> line4
>
> Now when I press Ctrl-] on line 1 on text "line3", it positions me to
> the 3. line (the line with text line2 and not the one with text
> line3).

It sounds like you're making a tags file that uses line numbers to
locate symbols instead of using searches; as you've seen that doesn't
work terribly well with files that are changing.  Making a tags file
that uses searches instead, it works fine for me.

<snip>
line1   testfile        /^line1
line2   testfile        /^line2
line3   testfile        /^line3
line4   testfile        /^line4
<snap>

Note that the tags file contains 8 tabs and no spaces.  Vim (afaik)
does no internal caching of the tags file and reads it from disk every
time a tag is requested, so the problem you're seeing isn't caused by
some internal cache going out of date, it's caused by the tags file
going out of date.

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to