Wednesday, January 25, 2012

Re: tracking text

sinbad <sinbad.sinbad@gmail.com> a écrit:
>
> hi,
>
> i want to track text in a file. an example file as below.
>
> --------
> simple
> jack
> -------
>
> now i want to track the text "jack", so i remember it's
> position in the file. Now content can be added in the
> file anywhere, if new content is added to file after "jack"
> there is no problem, but if it is added before "jack", i've
> to update the stored position for "jack".
>
> so now the question is how do i keep track of how many
> lines are added, deleted etc, is there any au command
> to do this. the catch here is i want to update the postion
> "jack" once the text is entered, not necessarily after
> doing :w

Aren't marks good enough? Mark the line containing "jack", and then use
the mark, or if you want the line number use line("'x"), where "x" is
your mark. Vim will keep track of it better than any hack.

If marks are unknown to you, try ":help bookmark".

Best,
Paul

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: