Bram Moolenaar | 662db67 | 2011-03-22 14:05:35 +0100 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Upstart job files |
| 3 | " Maintainer: Michael Biebl <biebl@debian.org> |
| 4 | " James Hunt <james.hunt@ubuntu.com> |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 5 | " Last Change: 2012 Jan 16 |
| 6 | " License: The Vim license |
Bram Moolenaar | 662db67 | 2011-03-22 14:05:35 +0100 | [diff] [blame] | 7 | " Version: 0.4 |
| 8 | " Remark: Syntax highlighting for Upstart (init(8)) job files. |
| 9 | " |
| 10 | " It is inspired by the initng syntax file and includes sh.vim to do the |
| 11 | " highlighting of script blocks. |
| 12 | |
| 13 | if version < 600 |
| 14 | syntax clear |
| 15 | elseif exists("b:current_syntax") |
| 16 | finish |
| 17 | endif |
| 18 | |
| 19 | let is_bash = 1 |
| 20 | syn include @Shell syntax/sh.vim |
| 21 | |
| 22 | syn case match |
| 23 | |
| 24 | " avoid need to use 'match' for most events |
| 25 | setlocal iskeyword+=- |
| 26 | |
| 27 | syn match upstartComment /#.*$/ contains=upstartTodo |
| 28 | syn keyword upstartTodo TODO FIXME contained |
| 29 | |
| 30 | syn region upstartString start=/"/ end=/"/ skip=/\\"/ |
| 31 | |
| 32 | syn region upstartScript matchgroup=upstartStatement start="script" end="end script" contains=@upstartShellCluster |
| 33 | |
| 34 | syn cluster upstartShellCluster contains=@Shell |
| 35 | |
| 36 | " one argument |
| 37 | syn keyword upstartStatement description author version instance expect |
| 38 | syn keyword upstartStatement pid kill normal console env exit export |
| 39 | syn keyword upstartStatement umask nice oom chroot chdir exec |
| 40 | |
| 41 | " two arguments |
| 42 | syn keyword upstartStatement limit |
| 43 | |
| 44 | " one or more arguments (events) |
| 45 | syn keyword upstartStatement emits |
| 46 | |
| 47 | syn keyword upstartStatement on start stop |
| 48 | |
| 49 | " flag, no parameter |
| 50 | syn keyword upstartStatement respawn service instance manual debug task |
| 51 | |
| 52 | " prefix for exec or script |
| 53 | syn keyword upstartOption pre-start post-start pre-stop post-stop |
| 54 | |
| 55 | " option for kill |
| 56 | syn keyword upstartOption timeout |
| 57 | " option for oom |
| 58 | syn keyword upstartOption never |
| 59 | " options for console |
| 60 | syn keyword upstartOption output owner |
| 61 | " options for expect |
| 62 | syn keyword upstartOption fork daemon |
| 63 | " options for limit |
| 64 | syn keyword upstartOption unlimited |
| 65 | |
| 66 | " 'options' for start/stop on |
| 67 | syn keyword upstartOption and or |
| 68 | |
| 69 | " Upstart itself and associated utilities |
| 70 | syn keyword upstartEvent runlevel |
| 71 | syn keyword upstartEvent started |
| 72 | syn keyword upstartEvent starting |
| 73 | syn keyword upstartEvent startup |
| 74 | syn keyword upstartEvent stopped |
| 75 | syn keyword upstartEvent stopping |
| 76 | syn keyword upstartEvent control-alt-delete |
| 77 | syn keyword upstartEvent keyboard-request |
| 78 | syn keyword upstartEvent power-status-changed |
| 79 | |
| 80 | " D-Bus |
| 81 | syn keyword upstartEvent dbus-activation |
| 82 | |
| 83 | " Display Manager (ie gdm) |
| 84 | syn keyword upstartEvent desktop-session-start |
| 85 | syn keyword upstartEvent login-session-start |
| 86 | |
| 87 | " mountall |
| 88 | syn keyword upstartEvent all-swaps |
| 89 | syn keyword upstartEvent filesystem |
| 90 | syn keyword upstartEvent mounted |
| 91 | syn keyword upstartEvent mounting |
| 92 | syn keyword upstartEvent local-filesystems |
| 93 | syn keyword upstartEvent remote-filesystems |
| 94 | syn keyword upstartEvent virtual-filesystems |
| 95 | |
| 96 | " SysV umountnfs.sh |
| 97 | syn keyword upstartEvent mounted-remote-filesystems |
| 98 | |
| 99 | " upstart-udev-bridge and ifup/down |
| 100 | syn match upstartEvent /\<\i\{-1,}-device-\(added\|removed\|up\|down\)/ |
| 101 | |
| 102 | " upstart-socket-bridge |
| 103 | syn keyword upstartEvent socket |
| 104 | |
| 105 | hi def link upstartComment Comment |
| 106 | hi def link upstartTodo Todo |
| 107 | hi def link upstartString String |
| 108 | hi def link upstartStatement Statement |
| 109 | hi def link upstartOption Type |
| 110 | hi def link upstartEvent Define |
| 111 | |
| 112 | let b:current_syntax = "upstart" |