Wednesday, December 9, 2020

Re: Matching words within X lines [PS]

On 07/12/2020 13.59, A. Wik wrote:
> Now, I want to do the following
> :redir @m
> :g/future.*ref.*\n.*\n
> :redir END
>
> Alternatively, instead of redir, I can use [...]/y M at the end of the
> :g command.
>
> Alas, :g includes only the line matching "future.*ref". I want to
> capture the whole match. Is there a way to do that?

It would seem that what's wrong with the first command is simply that
:p, which is the command used by default by :g, by itself prints only
*one* line. If you instead explicitly use :p {count}, e.g.
":g/future.*ref.*\n.*\n/p 3", it seems to work.

But, was this what you meant to ask in the first question, or an
additional issue?
«trying to match a couple (maybe more later) of words occurring within 3
lines of each other in any order» seems to mean more what Tim helped you
with...?


Gabriele

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4ce70bdd-4ea7-0215-2454-e90227c83bb6%40tiscali.it.

No comments: