"relative" marks?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

"relative" marks?

Chris Lott
Is there a way to set a mark (or similar) that is relative to a word?
For instance, given the following text:

Foo bar. Baz.
And more stuff.

I'd like to be able to quickly jump to the space after "bar." even if
the text has been changed to something like:

Additional text. Foo bar. Baz.
And more stuff.

c
--
Chris Lott <[hidden email]>

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: "relative" marks?

Christian Brabandt
Hi Chris!

On Mi, 07 Mai 2014, 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:
>
> Foo bar. Baz.
> And more stuff.
>
> I'd like to be able to quickly jump to the space after "bar." even if
> the text has been changed to something like:
>
> Additional text. Foo bar. Baz.
> And more stuff.

Not completely, but perhaps you can set tags to do it for you (not, that
I know much about it).

Best,
Christian
--
Frauen schulden keiner einzigen Religion Dank für auch nur einen
Impuls der Freiheit.
                -- Susan Brownell Anthony

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: "relative" marks?

JohnBeckett
In reply to this post by Chris Lott
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:
>
> Foo bar. Baz.
> And more stuff.
>
> 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.

John


--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: "relative" marks?

Eli the Bearded
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.