I'd like to highlight sections of a document which are too long (measured in lines) so they will all print on a physical page. Sections are separated with ===
. I tried to do it with this code:
matchadd('ErrorMsg', '\%(^\|===\n\)\%(.*\n\)\{5}\zs\%(.*\n\)\+\ze', -1)
Everything works hunky-dory. But when I increase the size:
matchadd('ErrorMsg', '\%(^\|===\n\)\%(.*\n\)\{80}\zs\%(.*\n\)\+\ze', -1)
matches don't highlight. From the documentation :matchadd
:
Defines a pattern to be highlighted in the current window (a
"match")
Based on figuring out where exactly the problem happens, I think it's not using text outside the current window. What should I be doing instead? Sections are already associated with folds if that helps.