Saturday, May 22, 2021

Bug/inconsistency in /\%'/ in linewise-vs-characterwise?

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/


--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210522145531.24fe6d04%40bigbox.attlocal.net.

No comments:

Post a Comment