Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: initng .i files |
| 3 | " Maintainer: Elan Ruusamäe <glen@pld-linux.org> |
| 4 | " URL: http://glen.alkohol.ee/pld/initng/ |
| 5 | " License: GPL v2 |
| 6 | " Version: 0.13 |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 7 | " Last Change: $Date: 2007/05/05 17:17:40 $ |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 8 | " |
| 9 | " Syntax highlighting for initng .i files. Inherits from sh.vim and adds |
| 10 | " in the hiliting to start/stop {} blocks. Requires vim 6.3 or later. |
| 11 | |
| 12 | if &compatible || v:version < 603 |
| 13 | finish |
| 14 | endif |
| 15 | |
| 16 | if exists("b:current_syntax") |
| 17 | finish |
| 18 | endif |
| 19 | |
| 20 | syn case match |
| 21 | |
| 22 | let is_bash = 1 |
| 23 | unlet! b:current_syntax |
| 24 | syn include @shTop syntax/sh.vim |
| 25 | |
| 26 | syn region initngService matchgroup=initngServiceHeader start="^\s*\(service\|virtual\|daemon\|class\|cron\)\s\+\(\(\w\|[-/*]\)\+\(\s\+:\s\+\(\w\|[-/*]\)\+\)\?\)\s\+{" end="}" contains=@initngServiceCluster |
| 27 | syn cluster initngServiceCluster contains=initngComment,initngAction,initngServiceOption,initngServiceHeader,initngDelim,initngVariable |
| 28 | |
| 29 | syn region initngAction matchgroup=initngActionHeader start="^\s*\(script start\|script stop\|script run\)\s*=\s*{" end="}" contains=@initngActionCluster |
| 30 | syn cluster initngActionCluster contains=@shTop |
| 31 | |
| 32 | syn match initngDelim /[{}]/ contained |
| 33 | |
| 34 | syn region initngString start=/"/ end=/"/ skip=/\\"/ |
| 35 | |
| 36 | " option = value |
| 37 | syn match initngServiceOption /.\+\s*=.\+;/ contains=initngServiceKeywords,initngSubstMacro contained |
| 38 | " option without value |
| 39 | syn match initngServiceOption /\w\+;/ contains=initngServiceKeywords,initngSubstMacro contained |
| 40 | |
| 41 | " options with value |
| 42 | syn keyword initngServiceKeywords also_stop need use nice setuid contained |
| 43 | syn keyword initngServiceKeywords delay chdir suid sgid start_pause env_file env_parse pid_file pidfile contained |
| 44 | syn keyword initngServiceKeywords pid_of up_when_pid_set stdout stderr syncron just_before contained |
| 45 | syn keyword initngServiceKeywords provide lockfile daemon_stops_badly contained |
| 46 | syn match initngServiceKeywords /\(script\|exec\(_args\)\?\) \(start\|stop\|daemon\)/ contained |
| 47 | syn match initngServiceKeywords /env\s\+\w\+/ contained |
| 48 | |
| 49 | " rlimits |
| 50 | syn keyword initngServiceKeywords rlimit_cpu_hard rlimit_core_soft contained |
| 51 | |
| 52 | " single options |
| 53 | syn keyword initngServiceKeywords last respawn network_provider require_network require_file critical forks contained |
| 54 | " cron options |
| 55 | syn keyword initngServiceKeywords hourly contained |
| 56 | syn match initngVariable /\${\?\w\+\}\?/ |
| 57 | |
| 58 | " Substituted @foo@ macros: |
| 59 | " ========== |
| 60 | syn match initngSubstMacro /@[^@]\+@/ contained |
| 61 | syn cluster initngActionCluster add=initngSubstMacro |
| 62 | syn cluster shCommandSubList add=initngSubstMacro |
| 63 | |
| 64 | " Comments: |
| 65 | " ========== |
| 66 | syn cluster initngCommentGroup contains=initngTodo,@Spell |
| 67 | syn keyword initngTodo TODO FIXME XXX contained |
| 68 | syn match initngComment /#.*$/ contains=@initngCommentGroup |
| 69 | |
| 70 | " install_service #macros |
| 71 | " TODO: syntax check for ifd-endd pairs |
| 72 | " ========== |
| 73 | syn region initngDefine start="^#\(endd\|elsed\|exec\|ifd\|endexec\|endd\)\>" skip="\\$" end="$" end="#"me=s-1 |
| 74 | syn cluster shCommentGroup add=initngDefine |
| 75 | syn cluster initngCommentGroup add=initngDefine |
| 76 | |
| 77 | hi def link initngComment Comment |
| 78 | hi def link initngTodo Todo |
| 79 | |
| 80 | hi def link initngString String |
| 81 | hi def link initngServiceKeywords Define |
| 82 | |
| 83 | hi def link initngServiceHeader Keyword |
| 84 | hi def link initngActionHeader Type |
| 85 | hi def link initngDelim Delimiter |
| 86 | |
| 87 | hi def link initngVariable PreProc |
| 88 | hi def link initngSubstMacro Comment |
| 89 | hi def link initngDefine Macro |
| 90 | |
| 91 | let b:current_syntax = "initng" |