Saturday, June 1, 2013

Re: search with offset

On 2013-06-01 11:40, Marcin Szamotulski wrote:
> Do you know how to repeat vim search preserving the offset. For
> example /hello/;?Mark?
> the n and N commands seems to forget about the offset, well actually
> they forget about the patter and remember only the offset.

This is strange, as n/N remember the other {offset} modifiers:

/thing/e
n

goes to the end of the next "thing" match. I'd consider classifying
this as a bug: either in behavior, or in (lack of)
clarification in the documentation.

> I have found that vim remembers the whole search
> pattern+offset in the search history (:h :histget()).

With this information, you could do something like

:nnoremap n /<up><cr>

to get "n" behavior, but it gets tricky when you want to reverse it
(you'd have to swap the "/" for "?" in the "right" placs, and define
whether you want to search backwards for pattern#1, then forwards
for pattern#2 (what I suspect you want), or backwards for pattern#1
and then backwards further for pattern#2.

-tim


--
--
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/groups/opt_out.

No comments:

Post a Comment