I'm trying to write a syntax file for Linux logrotate scripts.
Often they contain inline definitions of scripts to be run before or after the rotate action.
An example (the
cups-daemon logrotate script as provided by Ubuntu 14.04):
prerotate if [ -e /var/run/cups/cupsd.pid ]; then invoke-rc.d --quiet cups stop > /dev/null touch /var/run/cups/cupsd.stopped fi endscript postrotate if [ -e /var/run/cups/cupsd.stopped ]; then rm /var/run/cups/cupsd.stopped invoke-rc.d --quiet cups start > /dev/null sleep 10 fi endscript
Is there any way to both:
postrotateas keywords, and
- highlight all in between as a region?
I may define proper highlighting for either of those, but it seems not for both.
" this works syntax keyword LogrotateKeyword prerotate postrotate endscript " this also works syntax region LogrotateScript start=/prerotate/ms=e+1 end=/endscript/me=s-1
Now both of those in the same syntax file yield only highlighting for keywords, regardless of the rule order used.
\ze or lookaheads/lookbehinds) instead of
region too. I also tried to use
match for both the keywords and inline scripts, hoping it would not make the definitions overlap, the results seem to be just the same.
I might keep the default color for the inline script, but apparently frequently the inline stuff contains other logrotate keywords, which might be confusing.
Most likely irrelevant to this issue: Vim 7.4 with patches 1-1529 (pi-rho PPA) and Ubuntu 14.04.