Open bstaletic opened 6 years ago
That happens because the plugin is using two character at the start and the end of substitution string as a markers for highlighting pattern. Markers could be reduced by one on each side but that would only ameliorate the problem and in some cases break the pattern (e.g. user is using those characters in their substitution string).
They are normally not visible because the plugin is using Conceal group to hide them. Sadly, Vim doesn't seem to care much about concealed characters when computing wrapping positions.
Maybe it should be reported to Vim's issue tracker; I'm not sure how much interest it would gather or would it be deemed as a bug.
As a workaround, it should be possible to collect marks' positions, remove them and then use matchaddpos
to highlight substitution string.
Thanks for explaining what's going on. Like I said, this isn't a big deal for me.
Maybe it should be reported to Vim's issue tracker; I'm not sure how much interest it would gather or would it be deemed as a bug.
I doubt it would be considered a bug. A feature request... maybe. But then, considering the length of the vim's todo list, I'd expect that we'd have to do the work ourselves. At that point we might as well port inccommand
to vim.
As a workaround, it should be possible to collect marks' positions, remove them and then use matchaddpos to highlight substitution string.
I experimented a bit with this approach but I couldn't make it fast enough. Instead, I changed characters used for marks.
If encoding is utf-8, preview will now wrap 2 characters early. For any other encoding wrap will happen 4 characters early.
I also removed a way to set custom marks, as I don't think it's necessary anymore.
I just found out about this plugin and so far I like it a lot.
While the live substitution preview, if the substitution string gets long enough for the line to wrap (
set wrap
is on), the preview wraps 8 characters before the end of the visual line is reached.This isn't a big deal, but when a live substitution early-wraps on a line that otherwise wouldn't wrap, the opening of a new visual line that gets closed the moment a user hits
<CR>
and the command executes.