Re: Matching words within X lines [PS]

2020-12-10 Thread Gabriele F
On 10/12/2020 17.56, A. Wik wrote: You are right. And in this particular case, the regex can be simplified to "/future.*ref/". Sure -- -- 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

Re: Matching words within X lines [PS]

2020-12-10 Thread A. Wik
On Thu, 10 Dec 2020 at 16:32, Gabriele F wrote: > > 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

Re: Matching words within X lines [PS]

2020-12-10 Thread Gabriele F
On 10/12/2020 16.29, A. Wik wrote: On Wed, 9 Dec 2020 at 19:35, Gabriele F 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

Re: Matching words within X lines [PS]

2020-12-10 Thread A. Wik
On Wed, 9 Dec 2020 at 19:35, Gabriele F 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

Re: Matching words within X lines [PS]

2020-12-09 Thread Gabriele F
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

Re: Matching words within X lines [PS]

2020-12-07 Thread A. Wik
On Mon, 7 Dec 2020 at 02:29, Tim Chase wrote: > > On 2020-12-06 20:23, Tim Chase wrote: > > They're ugly, but vim will at least let you do them. > > Oh, one other caveat: it only finds the bookends and starts the next > search after the closing bookend. So if there is the possiblity that > the

Re: Matching words within X lines [PS]

2020-12-06 Thread Tim Chase
On 2020-12-06 20:23, Tim Chase wrote: > They're ugly, but vim will at least let you do them. Oh, one other caveat: it only finds the bookends and starts the next search after the closing bookend. So if there is the possiblity that the matches overlap, such as searching for "A...B" and you have

Re: Matching words within X lines

2020-12-06 Thread Tim Chase
On 2020-12-06 18:11, A. Wik wrote: > I'm trying to match a couple (maybe more later) of words occurring > within 3 lines of each other in any order. Is there a way to do > this with a Vim regex? The short answer is "yes", but the specifics depend on what you mean. Can the words come in any

Matching words within X lines

2020-12-06 Thread A. Wik
Hi all, I'm trying to match a couple (maybe more later) of words occurring within 3 lines of each other in any order. Is there a way to do this with a Vim regex? -Albert. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are