Improve user experience on initialization
[vim-cocoa.git] / runtime / syntax / initng.vim
blob49c2d00dd528fa8010ae5df4a651bf1e38fb0963
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
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
13         finish
14 endif
16 if exists("b:current_syntax")
17         finish
18 endif
20 syn case match
22 let is_bash = 1
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=/\\"/
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
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
49 " rlimits
50 syn keyword     initngServiceKeywords   rlimit_cpu_hard rlimit_core_soft contained
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\+\}\?/
58 " Substituted @foo@ macros:
59 " ==========
60 syn match       initngSubstMacro                /@[^@]\+@/      contained
61 syn cluster initngActionCluster         add=initngSubstMacro
62 syn cluster shCommandSubList            add=initngSubstMacro
64 " Comments:
65 " ==========
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
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
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"