initng.vim 3.3 KB

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