2 " Language: initng .i files
3 " Maintainer: Elan Ruusamäe <glen@pld-linux.org>
4 " URL: http://glen.alkohol.ee/pld/initng/
7 " Last Change: $Date: 2008/08/09 17:40:53 $
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.
12 if &compatible || v:version < 603
16 if exists("b:current_syntax")
23 unlet! b:current_syntax
24 syn include @shTop syntax/sh.vim
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
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
32 syn match initngDelim /[{}]/ contained
34 syn region initngString start=/"/ end=/"/ skip=/\\"/
37 syn match initngServiceOption /.\+\s*=.\+;/ contains=initngServiceKeywords,initngSubstMacro contained
38 " option without value
39 syn match initngServiceOption /\w\+;/ contains=initngServiceKeywords,initngSubstMacro contained
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
50 syn keyword initngServiceKeywords rlimit_cpu_hard rlimit_core_soft contained
53 syn keyword initngServiceKeywords last respawn network_provider require_network require_file critical forks contained
55 syn keyword initngServiceKeywords hourly contained
56 syn match initngVariable /\${\?\w\+\}\?/
58 " Substituted @foo@ macros:
60 syn match initngSubstMacro /@[^@]\+@/ contained
61 syn cluster initngActionCluster add=initngSubstMacro
62 syn cluster shCommandSubList add=initngSubstMacro
66 syn cluster initngCommentGroup contains=initngTodo,@Spell
67 syn keyword initngTodo TODO FIXME XXX contained
68 syn match initngComment /#.*$/ contains=@initngCommentGroup
70 " install_service #macros
71 " TODO: syntax check for ifd-endd pairs
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
77 hi def link initngComment Comment
78 hi def link initngTodo Todo
80 hi def link initngString String
81 hi def link initngServiceKeywords Define
83 hi def link initngServiceHeader Keyword
84 hi def link initngActionHeader Type
85 hi def link initngDelim Delimiter
87 hi def link initngVariable PreProc
88 hi def link initngSubstMacro Comment
89 hi def link initngDefine Macro
91 let b:current_syntax = "initng"