I have a file that looks something like this
def foo bar {{
// some stuff in here that shouldn't have }}; in it
}};
And I’d like to syntax highlight certain types of these blocks. My first order approximation was this:
highlight DefFoo ctermfg=darkgreen
let defFoo = 'def foo .* {{.*}};'
call matchadd('DefFoo', defFoo)
However, the only stuff that gets highlighted is the first line def foo bar {{ . I’ve been trying to find a way to execute a matchadd that searches globally, but I’ve been failing. Is there a way to do this?
The
.does not match new lines.\_.does on the other hand. So your pattern would be:I find for one off matches using something like the following to be nice:
It can be cleared with
Note that
:matchwith an expensive pattern may cause the matched text to not highlight properly on some screen redraws. Either adjust your pattern or up your'redrawtime'For more information: