blob: 36d75c4d13432974669bd490242d2e744d333794 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaarfc1421e2006-04-20 22:17:20 +00002" Language: crontab
3" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
4" Original Maintainer: John Hoelzel johnh51@users.sourceforge.net
5" License: This file can be redistribued and/or modified under the same terms
6" as Vim itself.
7" Filenames: /tmp/crontab.* used by "crontab -e"
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +02008" Last Change: 2012-05-16
Bram Moolenaar071d4272004-06-13 20:20:40 +00009"
10" crontab line format:
11" Minutes Hours Days Months Days_of_Week Commands # comments
12
13" For version 5.x: Clear all syntax items
14" For version 6.x: Quit when a syntax file was already loaded
15if version < 600
16 syntax clear
17elseif exists("b:current_syntax")
18 finish
19endif
20
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000021syntax match crontabMin "^\s*[-0-9/,.*]\+" nextgroup=crontabHr skipwhite
22syntax match crontabHr "\s[-0-9/,.*]\+" nextgroup=crontabDay skipwhite contained
23syntax match crontabDay "\s[-0-9/,.*]\+" nextgroup=crontabMnth skipwhite contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000025syntax match crontabMnth "\s[-a-z0-9/,.*]\+" nextgroup=crontabDow skipwhite contained
26syntax keyword crontabMnth12 contained jan feb mar apr may jun jul aug sep oct nov dec
Bram Moolenaar071d4272004-06-13 20:20:40 +000027
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000028syntax match crontabDow "\s[-a-z0-9/,.*]\+" nextgroup=crontabCmd skipwhite contained
29syntax keyword crontabDow7 contained sun mon tue wed thu fri sat
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000031syntax region crontabCmd start="\S" end="$" skipwhite contained keepend contains=crontabPercent
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020032syntax match crontabCmnt "^\s*#.*" contains=@Spell
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000033syntax match crontabPercent "[^\\]%.*"lc=1 contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000034
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000035syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\)\>" nextgroup=crontabCmd skipwhite
Bram Moolenaard9d30582005-05-18 22:10:28 +000036
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000037syntax match crontabVar "^\s*\k\w*\s*="me=e-1
Bram Moolenaar071d4272004-06-13 20:20:40 +000038
39" Define the default highlighting.
40" For version 5.7 and earlier: only when not done already
41" For version 5.8 and later: only when an item doesn't have highlighting yet
42if version >= 508 || !exists("did_crontab_syn_inits")
43 if version < 508
44 let did_crontab_syn_inits = 1
45 command -nargs=+ HiLink hi link <args>
46 else
47 command -nargs=+ HiLink hi def link <args>
48 endif
49
50 HiLink crontabMin Number
51 HiLink crontabHr PreProc
52 HiLink crontabDay Type
53
54 HiLink crontabMnth Number
55 HiLink crontabMnth12 Number
56 HiLink crontabMnthS Number
57 HiLink crontabMnthN Number
58
59 HiLink crontabDow PreProc
60 HiLink crontabDow7 PreProc
61 HiLink crontabDowS PreProc
62 HiLink crontabDowN PreProc
63
Bram Moolenaard9d30582005-05-18 22:10:28 +000064 HiLink crontabNick Special
65 HiLink crontabVar Identifier
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000066 HiLink crontabPercent Special
Bram Moolenaard9d30582005-05-18 22:10:28 +000067
Bram Moolenaar071d4272004-06-13 20:20:40 +000068" comment out next line for to suppress unix commands coloring.
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000069 HiLink crontabCmd Statement
Bram Moolenaar071d4272004-06-13 20:20:40 +000070
71 HiLink crontabCmnt Comment
72
73 delcommand HiLink
74endif
75
76let b:current_syntax = "crontab"
77
78" vim: ts=8