Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | d9d3058 | 2005-05-18 22:10:28 +0000 | [diff] [blame] | 2 | " Language: crontab |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3 | " Maintainer: John Hoelzel johnh51@users.sourceforge.net |
Bram Moolenaar | d9d3058 | 2005-05-18 22:10:28 +0000 | [diff] [blame] | 4 | " Maintainer: David Necas (Yeti) <yeti@physics.muni.cz> |
| 5 | " Last Change: 2005-04-26 |
| 6 | " Filenames: /tmp/crontab.* used by "crontab -e" |
| 7 | " URL: http://trific.ath.cx/Ftp/vim/syntax/crontab.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | " |
| 9 | " crontab line format: |
| 10 | " Minutes Hours Days Months Days_of_Week Commands # comments |
| 11 | |
| 12 | " For version 5.x: Clear all syntax items |
| 13 | " For version 6.x: Quit when a syntax file was already loaded |
| 14 | if version < 600 |
| 15 | syntax clear |
| 16 | elseif exists("b:current_syntax") |
| 17 | finish |
| 18 | endif |
| 19 | |
Bram Moolenaar | d9d3058 | 2005-05-18 22:10:28 +0000 | [diff] [blame] | 20 | syntax match crontabMin "^\s*[-0-9/,.*]\+" nextgroup=crontabHr skipwhite |
| 21 | syntax match crontabHr "\s[-0-9/,.*]\+" nextgroup=crontabDay skipwhite contained |
| 22 | syntax match crontabDay "\s[-0-9/,.*]\+" nextgroup=crontabMnth skipwhite contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 23 | |
Bram Moolenaar | d9d3058 | 2005-05-18 22:10:28 +0000 | [diff] [blame] | 24 | syntax match crontabMnth "\s[-a-z0-9/,.*]\+" nextgroup=crontabDow skipwhite contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 25 | syntax keyword crontabMnth12 contained jan feb mar apr may jun jul aug sep oct nov dec |
| 26 | |
Bram Moolenaar | d9d3058 | 2005-05-18 22:10:28 +0000 | [diff] [blame] | 27 | syntax match crontabDow "\s[-a-z0-9/,.*]\+" nextgroup=crontabCmd skipwhite contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | syntax keyword crontabDow7 contained sun mon tue wed thu fri sat |
| 29 | |
| 30 | " syntax region crontabCmd start="\<[a-z0-9\/\(]" end="$" nextgroup=crontabCmnt skipwhite contained contains=crontabCmnt keepend |
| 31 | |
Bram Moolenaar | d9d3058 | 2005-05-18 22:10:28 +0000 | [diff] [blame] | 32 | syntax region crontabCmd start="\S" end="$" nextgroup=crontabCmnt skipwhite contained keepend |
| 33 | syntax match crontabCmnt "^\s*#.*" |
| 34 | |
| 35 | syntax match crontabNick "^\s*@\(reboot\|yearly\|annually\|monthly\|weekly\|daily\|midnight\|hourly\)\>" nextgroup=crontabCmd skipwhite |
| 36 | |
| 37 | syntax match crontabVar "^\s*\k\w*\s*="me=e-1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 38 | |
| 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 |
| 42 | if 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 Moolenaar | d9d3058 | 2005-05-18 22:10:28 +0000 | [diff] [blame] | 64 | HiLink crontabNick Special |
| 65 | HiLink crontabVar Identifier |
| 66 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 67 | " comment out next line for to suppress unix commands coloring. |
| 68 | HiLink crontabCmd Type |
| 69 | |
| 70 | HiLink crontabCmnt Comment |
| 71 | |
| 72 | delcommand HiLink |
| 73 | endif |
| 74 | |
| 75 | let b:current_syntax = "crontab" |
| 76 | |
| 77 | " vim: ts=8 |