On Wed, 9 Dec 2020 at 19:35, Gabriele F <[email protected]> wrote: > > 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.
Yes, but I want to collect the text that was *matched* by the pattern, so, with ":g/future.*ref.*\n.*\n", I want the "future" until the end of the next line. Actually, what I want is the whole line containing the match, as well as the whole of the next line, but that is a simple matter of adding a "^.*". > But, was this what you meant to ask in the first question, or an > additional issue? 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...? That was the question he helped me with. I ran into the additional issue later. -aw -- -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CALPW7mSfiADH56mfWMguSo94qWJX7a55S%2B8FH-BNMoEy%2BgHp3Q%40mail.gmail.com.
