blob: 1a912c1d051fe7454b30baeed10a391c97ff0598 [file] [log] [blame]
Bram Moolenaar9964e462007-05-05 17:54:07 +00001" 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 Moolenaar5c736222010-01-06 20:54:52 +01007" Last Change: $Date: 2007/05/05 17:17:40 $
Bram Moolenaar9964e462007-05-05 17:54:07 +00008"
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
12if &compatible || v:version < 603
13 finish
14endif
15
16if exists("b:current_syntax")
17 finish
18endif
19
20syn case match
21
22let is_bash = 1
23unlet! b:current_syntax
24syn include @shTop syntax/sh.vim
25
26syn region initngService matchgroup=initngServiceHeader start="^\s*\(service\|virtual\|daemon\|class\|cron\)\s\+\(\(\w\|[-/*]\)\+\(\s\+:\s\+\(\w\|[-/*]\)\+\)\?\)\s\+{" end="}" contains=@initngServiceCluster
27syn cluster initngServiceCluster contains=initngComment,initngAction,initngServiceOption,initngServiceHeader,initngDelim,initngVariable
28
29syn region initngAction matchgroup=initngActionHeader start="^\s*\(script start\|script stop\|script run\)\s*=\s*{" end="}" contains=@initngActionCluster
30syn cluster initngActionCluster contains=@shTop
31
32syn match initngDelim /[{}]/ contained
33
34syn region initngString start=/"/ end=/"/ skip=/\\"/
35
36" option = value
37syn match initngServiceOption /.\+\s*=.\+;/ contains=initngServiceKeywords,initngSubstMacro contained
38" option without value
39syn match initngServiceOption /\w\+;/ contains=initngServiceKeywords,initngSubstMacro contained
40
41" options with value
42syn keyword initngServiceKeywords also_stop need use nice setuid contained
43syn keyword initngServiceKeywords delay chdir suid sgid start_pause env_file env_parse pid_file pidfile contained
44syn keyword initngServiceKeywords pid_of up_when_pid_set stdout stderr syncron just_before contained
45syn keyword initngServiceKeywords provide lockfile daemon_stops_badly contained
46syn match initngServiceKeywords /\(script\|exec\(_args\)\?\) \(start\|stop\|daemon\)/ contained
47syn match initngServiceKeywords /env\s\+\w\+/ contained
48
49" rlimits
50syn keyword initngServiceKeywords rlimit_cpu_hard rlimit_core_soft contained
51
52" single options
53syn keyword initngServiceKeywords last respawn network_provider require_network require_file critical forks contained
54" cron options
55syn keyword initngServiceKeywords hourly contained
56syn match initngVariable /\${\?\w\+\}\?/
57
58" Substituted @foo@ macros:
59" ==========
60syn match initngSubstMacro /@[^@]\+@/ contained
61syn cluster initngActionCluster add=initngSubstMacro
62syn cluster shCommandSubList add=initngSubstMacro
63
64" Comments:
65" ==========
66syn cluster initngCommentGroup contains=initngTodo,@Spell
67syn keyword initngTodo TODO FIXME XXX contained
68syn match initngComment /#.*$/ contains=@initngCommentGroup
69
70" install_service #macros
71" TODO: syntax check for ifd-endd pairs
72" ==========
73syn region initngDefine start="^#\(endd\|elsed\|exec\|ifd\|endexec\|endd\)\>" skip="\\$" end="$" end="#"me=s-1
74syn cluster shCommentGroup add=initngDefine
75syn cluster initngCommentGroup add=initngDefine
76
77hi def link initngComment Comment
78hi def link initngTodo Todo
79
80hi def link initngString String
81hi def link initngServiceKeywords Define
82
83hi def link initngServiceHeader Keyword
84hi def link initngActionHeader Type
85hi def link initngDelim Delimiter
86
87hi def link initngVariable PreProc
88hi def link initngSubstMacro Comment
89hi def link initngDefine Macro
90
91let b:current_syntax = "initng"