0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

runtime(crontab): add support for BSD specifics in syntax script (#11196)

* OpenBSD supports the use of `~` as alias for "random valid value"
* FreeBSD supports `@every_{minute,second}`

See:

* https://man.openbsd.org/crontab.5
* https://www.freebsd.org/cgi/man.cgi?query=crontab&sektion=5

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Moviuro 2023-08-22 22:24:26 +02:00 committed by GitHub
parent 2ae7ffe0bc
commit cdd934439d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@
" License: This file can be redistribued and/or modified under the same terms " License: This file can be redistribued and/or modified under the same terms
" as Vim itself. " as Vim itself.
" Filenames: /tmp/crontab.* used by "crontab -e" " Filenames: /tmp/crontab.* used by "crontab -e"
" Last Change: 2015-01-20 " Last Change: 2022-09-22
" "
" crontab line format: " crontab line format:
" Minutes Hours Days Months Days_of_Week Commands # comments " Minutes Hours Days Months Days_of_Week Commands # comments
@ -15,20 +15,20 @@ if exists("b:current_syntax")
finish finish
endif endif
syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\)\>" nextgroup=crontabCmd skipwhite syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\|every_minute\|every_second\)\>" nextgroup=crontabCmd skipwhite
syntax match crontabVar "^\s*\k\w*\s*="me=e-1 syntax match crontabVar "^\s*\k\w*\s*="me=e-1
syntax case ignore syntax case ignore
syntax match crontabMin "^\s*[-0-9/,.*]\+" nextgroup=crontabHr skipwhite syntax match crontabMin "^\s*[-~0-9/,.*]\+" nextgroup=crontabHr skipwhite
syntax match crontabHr "\s[-0-9/,.*]\+" nextgroup=crontabDay skipwhite contained syntax match crontabHr "\s[-~0-9/,.*]\+" nextgroup=crontabDay skipwhite contained
syntax match crontabDay "\s[-0-9/,.*]\+" nextgroup=crontabMnth skipwhite contained syntax match crontabDay "\s[-~0-9/,.*]\+" nextgroup=crontabMnth skipwhite contained
syntax match crontabMnth "\s[-a-z0-9/,.*]\+" nextgroup=crontabDow skipwhite contained syntax match crontabMnth "\s[-~a-z0-9/,.*]\+" nextgroup=crontabDow skipwhite contained
syntax keyword crontabMnth12 contained jan feb mar apr may jun jul aug sep oct nov dec syntax keyword crontabMnth12 contained jan feb mar apr may jun jul aug sep oct nov dec
syntax match crontabDow "\s[-a-z0-9/,.*]\+" nextgroup=crontabCmd skipwhite contained syntax match crontabDow "\s[-~a-z0-9/,.*]\+" nextgroup=crontabCmd skipwhite contained
syntax keyword crontabDow7 contained sun mon tue wed thu fri sat syntax keyword crontabDow7 contained sun mon tue wed thu fri sat
syntax region crontabCmd start="\S" end="$" skipwhite contained keepend contains=crontabPercent syntax region crontabCmd start="\S" end="$" skipwhite contained keepend contains=crontabPercent