blob: 117f98d7540af0233640067fd98507a154db915f [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"
8" URL: http://trific.ath.cx/Ftp/vim/syntax/crontab.vim
9" Last Change: 2006-04-20
Bram Moolenaar071d4272004-06-13 20:20:40 +000010"
11" crontab line format:
12" Minutes Hours Days Months Days_of_Week Commands # comments
13
14" For version 5.x: Clear all syntax items
15" For version 6.x: Quit when a syntax file was already loaded
16if version < 600
17 syntax clear
18elseif exists("b:current_syntax")
19 finish
20endif
21
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000022syntax match crontabMin "^\s*[-0-9/,.*]\+" nextgroup=crontabHr skipwhite
23syntax match crontabHr "\s[-0-9/,.*]\+" nextgroup=crontabDay skipwhite contained
24syntax match crontabDay "\s[-0-9/,.*]\+" nextgroup=crontabMnth skipwhite contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000025
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 Moolenaarfc1421e2006-04-20 22:17:20 +000032syntax region crontabCmd start="\S" end="$" skipwhite contained keepend contains=crontabPercent
33syntax match crontabCmnt "^\s*#.*"
34syntax match crontabPercent "[^\\]%.*"lc=1 contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000035
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000036syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\)\>" nextgroup=crontabCmd skipwhite
Bram Moolenaard9d30582005-05-18 22:10:28 +000037
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000038syntax match crontabVar "^\s*\k\w*\s*="me=e-1
Bram Moolenaar071d4272004-06-13 20:20:40 +000039
40" Define the default highlighting.
41" For version 5.7 and earlier: only when not done already
42" For version 5.8 and later: only when an item doesn't have highlighting yet
43if version >= 508 || !exists("did_crontab_syn_inits")
44 if version < 508
45 let did_crontab_syn_inits = 1
46 command -nargs=+ HiLink hi link <args>
47 else
48 command -nargs=+ HiLink hi def link <args>
49 endif
50
51 HiLink crontabMin Number
52 HiLink crontabHr PreProc
53 HiLink crontabDay Type
54
55 HiLink crontabMnth Number
56 HiLink crontabMnth12 Number
57 HiLink crontabMnthS Number
58 HiLink crontabMnthN Number
59
60 HiLink crontabDow PreProc
61 HiLink crontabDow7 PreProc
62 HiLink crontabDowS PreProc
63 HiLink crontabDowN PreProc
64
Bram Moolenaard9d30582005-05-18 22:10:28 +000065 HiLink crontabNick Special
66 HiLink crontabVar Identifier
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000067 HiLink crontabPercent Special
Bram Moolenaard9d30582005-05-18 22:10:28 +000068
Bram Moolenaar071d4272004-06-13 20:20:40 +000069" comment out next line for to suppress unix commands coloring.
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000070 HiLink crontabCmd Statement
Bram Moolenaar071d4272004-06-13 20:20:40 +000071
72 HiLink crontabCmnt Comment
73
74 delcommand HiLink
75endif
76
77let b:current_syntax = "crontab"
78
79" vim: ts=8