On 10/12/2020 16.29, A. Wik wrote:
On Wed, 9 Dec 2020 at 19:35, Gabriele F <[email protected]> wrote:
On 07/12/2020 13.59, A. Wik wrote:
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 "^.*".

Well if you want only from "future" I don't know, but if instead you want "the whole line containing the match, as well as the whole of the next line" ":g/future.*ref.*\n.*\n/p 2" seems to give that result, and only if there is a match (yes, I put "p 3" by mistake in the other mail).
Of course inelegant and inflexible, I don't know if there are better ways

--
--
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/024229c8-b4e7-6337-89e7-1dbe92567b81%40tiscali.it.

Reply via email to