eregex.vim icon indicating copy to clipboard operation
eregex.vim copied to clipboard

Multiline replacement does not seem to respect the range

Open nerdo opened this issue 2 years ago • 0 comments

When trying to do a replacement with multiline mode /m, when operating on either the visual range or a specific range, the range doesn't seem to be respected.

For example, if the file is...

abc
def
iWantThis: value
hjk
lmn
opq
rst

And I do :2,4S/.*iWantThis: (\w+).*/\1/m

The result is a file that looks like:

abc
value

but I'm expecting

abc
value
lmn
opq
rst

Doing a non-greedy match at the end sort of solves it, but the range should be respected since the input should be the range, not the entire buffer... I suspect this has something to do with being able to support lookahead outside of a range??

nerdo avatar Jul 13 '23 15:07 nerdo