How to make Vim syntax highlight characters exceeding a byte count within a paragraph?

Viewed 108

I would like to develop a syntax highlighter that is able to highlight text which exceeds a certain byte count. I've written a regex that can match the too-long text if it is not hard-wrapped:

\(^.*\)\@127<!.\+

Note that the behavior of the negative lookbehind assertion (\@127<!) is to count bytes, which is useful for handling multi-byte characters correctly in contrast to braces (e.g., doing ^.\{127}\zs.\+ instead) which count characters.

What I have been looking for is a modification that will work even if the lines are hard-wrapped and delineated by empty lines (i.e., as paragraphs), but that seems beyond the powers of Vim's syntax match commands. Are text properties perhaps the right way to go instead? If so, how would you implement this with text properties?

0 Answers
Related