blob: 74ab5615cb2ad94df714c32d92025a72139dd799 [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 Moolenaar8e5af3e2011-04-28 19:02:44 +02008" Last Change: 2011-04-21
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 Moolenaar8e5af3e2011-04-28 19:02:44 +020025syntax case ignore
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000026syntax match crontabMnth "\s[-a-z0-9/,.*]\+" nextgroup=crontabDow skipwhite contained
27syntax keyword crontabMnth12 contained jan feb mar apr may jun jul aug sep oct nov dec
Bram Moolenaar071d4272004-06-13 20:20:40 +000028
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000029syntax match crontabDow "\s[-a-z0-9/,.*]\+" nextgroup=crontabCmd skipwhite contained
30syntax keyword crontabDow7 contained sun mon tue wed thu fri sat
Bram Moolenaar071d4272004-06-13 20:20:40 +000031
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020032syntax case match
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000033syntax region crontabCmd start="\S" end="$" skipwhite contained keepend contains=crontabPercent
34syntax match crontabCmnt "^\s*#.*"
35syntax match crontabPercent "[^\\]%.*"lc=1 contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000036
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000037syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\)\>" nextgroup=crontabCmd skipwhite
Bram Moolenaard9d30582005-05-18 22:10:28 +000038
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000039syntax match crontabVar "^\s*\k\w*\s*="me=e-1
Bram Moolenaar071d4272004-06-13 20:20:40 +000040
41" Define the default highlighting.
42" For version 5.7 and earlier: only when not done already
43" For version 5.8 and later: only when an item doesn't have highlighting yet
44if version >= 508 || !exists("did_crontab_syn_inits")
45 if version < 508
46 let did_crontab_syn_inits = 1
47 command -nargs=+ HiLink hi link <args>
48 else
49 command -nargs=+ HiLink hi def link <args>
50 endif
51
52 HiLink crontabMin Number
53 HiLink crontabHr PreProc
54 HiLink crontabDay Type
55
56 HiLink crontabMnth Number
57 HiLink crontabMnth12 Number
58 HiLink crontabMnthS Number
59 HiLink crontabMnthN Number
60
61 HiLink crontabDow PreProc
62 HiLink crontabDow7 PreProc
63 HiLink crontabDowS PreProc
64 HiLink crontabDowN PreProc
65
Bram Moolenaard9d30582005-05-18 22:10:28 +000066 HiLink crontabNick Special
67 HiLink crontabVar Identifier
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000068 HiLink crontabPercent Special
Bram Moolenaard9d30582005-05-18 22:10:28 +000069
Bram Moolenaar071d4272004-06-13 20:20:40 +000070" comment out next line for to suppress unix commands coloring.
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000071 HiLink crontabCmd Statement
Bram Moolenaar071d4272004-06-13 20:20:40 +000072
73 HiLink crontabCmnt Comment
74
75 delcommand HiLink
76endif
77
78let b:current_syntax = "crontab"
79
80" vim: ts=8