Friday, May 9, 2014

Re: "relative" marks?

John Beckett wrote:
> Chris Lott wrote:
>> Is there a way to set a mark (or similar) that is relative to
>> a word? For instance, given the following text:
>> I'd like to be able to quickly jump to the space after "bar."
>> even if the text has been changed to something like:
> You could do a map. The following has a space after the "f".
> :nnoremap <F8> `af
> Pressing F8 will then jump to the position of mark a, then to
> the first space.

Marks remember "cursor position" not relative text. Your method
may work for some changes, but not all. If mark a is on line 12,
column 20, and then 40 characters with a space at the end get
inserted at the start of line 12, the F8 mapping you have there
will be way off.

A tag can contain any search pattern, and might work, again,
this will depend on the amount of editing it has to survive.
(In real vi, a tag can contain any ex mode command, vim's have
been tamed somewhat.) Something like this:

:%s/bar. /&&&&/

Would make it difficult to know where the mark should be.

Elijah

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment