Coming up in this thread[1] on Reddit, I highlighted some text in
*characterwise* visual mode ("v") and hit <esc> to end visual mode.
With 'hls' set, issuing
/\%'<\_.\{-}\%'>/
properly highlighted the range as expected.
So then I highlighted some text in *linewise* visual mode ("V") and
hit <esc> and the highlight was removed. Using "n" to search for the
next match gave me an
E486: Pattern not found: \%'<\_.\{-}\%'>
which seems mistaken. Having done the linewise search, I can use
`<
and
`>
which both jump properly to the corresponding endpoints of the
linewise visual selection, so in theory the
\_.\{-}
should match everything in between (non-greedy). I tried prepending
both
\%#=1
and alternatively
\%#=2
to force the regex parsing engine, but both were equally unsuccessful
with linewise mode. So it doesn't seem to be some weird edge-case of
either engine.
AFAICT, the regex *should* work for linewise visual selections, but
for some reason doesn't.
Is this a bug? Or just my misunderstanding of something?
Thanks,
-tim
[1]
https://www.reddit.com/r/vim/comments/ninhe1/is_there_a_plugin_for_highlighting_text_under/