├── README.md ├── ftdetect └── systemd.vim ├── ftplugin └── systemd.vim └── syntax └── systemd.vim /README.md: -------------------------------------------------------------------------------- 1 | # vim-systemd-syntax 2 | 3 | syntax highlighting and filetype detection for systemd unit files! 4 | 5 | ## Features 6 | 7 | * Highlights known unit file directives and recognizeable values! 8 | * Marks errors due to invalid or misspelled options/values! 9 | * Over 80 hours of playtime! 10 | 11 | ## Installation 12 | 13 | You can install `wgwoods/vim-systemd-syntax` pretty easily with your favorite 14 | Vim plugin manager. (If you don't have one already, 15 | [vim-plug](https://github.com/junegunn/vim-plug) is nice and simple.) 16 | 17 | This should probably work too: 18 | 19 | mkdir -p ~/.vim/plugin 20 | cd ~/.vim/plugin 21 | git clone https://github.com/wgwoods/vim-systemd-syntax 22 | 23 | Or you can just drop the three `.vim` files in `~/.vim/syntax`, 24 | `~/.vim/ftdetect`, and `/.vim/ftplugin` manually. I'm sure you'll figure it 25 | out, you red-hot vim hacker you. 26 | 27 | ## TODO 28 | 29 | * Add missing directives? 30 | (I haven't updated this since 2011. Pull requests welcome!) 31 | * Generate syntax from `/usr/lib/systemd/systemd --dump-config` 32 | so it's always up-to-date 33 | * Heck why doesn't [systemd] do that as part of its build? 34 | * Contribute script to [systemd] that generates `syntax/systemd.vim` for us 35 | * Retire to a life of leisure 36 | 37 | [systemd]: https://github.com/systemd/systemd/ 38 | 39 | ## License 40 | 41 | Distributed under the same terms as `vim` itself. 42 | -------------------------------------------------------------------------------- /ftdetect/systemd.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.automount set filetype=systemd 2 | au BufNewFile,BufRead *.mount set filetype=systemd 3 | au BufNewFile,BufRead *.path set filetype=systemd 4 | au BufNewFile,BufRead *.slice set filetype=systemd 5 | au BufNewFile,BufRead *.scope set filetype=systemd 6 | au BufNewFile,BufRead *.service set filetype=systemd 7 | au BufNewFile,BufRead *.socket set filetype=systemd 8 | au BufNewFile,BufRead *.swap set filetype=systemd 9 | au BufNewFile,BufRead *.target set filetype=systemd 10 | au BufNewFile,BufRead *.timer set filetype=systemd 11 | -------------------------------------------------------------------------------- /ftplugin/systemd.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype plugin file 2 | " Language: systemd unit files 3 | " Previous Maintainer: Will Woods 4 | " Latest Revision: Sep 25, 2019 5 | 6 | " These are, as it turns out, exactly the same settings as ftplugin/conf.vim 7 | 8 | if exists("b:did_ftplugin") 9 | finish 10 | endif 11 | let b:did_ftplugin = 1 12 | 13 | let s:cpo_save = &cpo 14 | set cpo&vim 15 | 16 | let b:undo_ftplugin = "setl com< cms< fo<" 17 | 18 | setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql 19 | 20 | let &cpo = s:cpo_save 21 | unlet s:cpo_save 22 | 23 | -------------------------------------------------------------------------------- /syntax/systemd.vim: -------------------------------------------------------------------------------- 1 | " Filename: systemd.vim 2 | " Purpose: Vim syntax file 3 | " Language: systemd unit files 4 | " Maintainer: Will Woods 5 | " Last Change: Sep 15, 2011 6 | 7 | if exists("b:current_syntax") && !exists ("g:syntax_debug") 8 | finish 9 | endif 10 | 11 | syn case match 12 | syntax sync fromstart 13 | setlocal iskeyword+=- 14 | 15 | " special sequences, common data types, comments, includes {{{1 16 | " hilight errors with this 17 | syn match sdErr contained /\s*\S\+/ nextgroup=sdErr 18 | " this doesn't set nextgroup - useful for list items 19 | syn match sdErrItem contained /\S\+/ contains=sdErr 20 | 21 | " environment args and format strings 22 | syn match sdEnvArg contained /\$\i\+\|\${\i\+}/ 23 | syn match sdFormatStr contained /%[bCEfhHiIjJLmnNpPsStTgGuUvV%]/ containedin=ALLBUT,sdComment,sdErr 24 | 25 | " common data types 26 | syn match sdUInt contained nextgroup=sdErr /\d\+/ 27 | syn match sdInt contained nextgroup=sdErr /-\=\d\+/ 28 | syn match sdOctal contained nextgroup=sdErr /0\o\{3,4}/ 29 | syn match sdByteVal contained /\<\%(\d\|\d\d\|1\d\d\|2[0-4]\d\|25[0-5]\)\>/ 30 | 31 | " sdDuration, sdCalendar: see systemd.time(7) 32 | syn match sdDuration contained nextgroup=sdErr /\d\+/ 33 | syn match sdDuration contained nextgroup=sdErr /\%(\d\+\s*\%(usec\|msec\|seconds\=\|minutes\=\|hours\=\|days\=\|weeks\=\|months\=\|years\=\|us\|ms\|sec\|min\|hr\|[smhdwMy]\)\s*\)\+/ 34 | 35 | " todo: make these not case-sensitive 36 | syn keyword sdCalendarDayNames Monday Tuesday Wednesday Thursday Friday Saturday Sunday Mon Tue Wed Thu Fri Sat Sun 37 | syn keyword sdCalendarInterval minutely hourly daily monthly weekly yearly quarterly semiannually 38 | syn match sdCalendarDays contained /\i\+\,\=\|\i\+\.\.\i\+\,\=/ contains=sdCalendarDayNames,sdErr 39 | syn match sdCalendarRepeat contained /\/\d\+\%(\.\d\+\)\=/ 40 | syn match sdCalendarSep contained /[,~:-]\|../ 41 | syn match sdCalendarYear contained /\d{4}\|\*/ 42 | syn match sdCalendarMonth contained /0\=[1-9]\|1[012]\|*/ 43 | syn match sdCalendarDay contained /0\=[1-9]\|12[0-9]\|3[01]\|*/ 44 | syn match sdCalendarHour contained /[01]\=[0-9]\|2[0-4]\|*/ 45 | syn match sdCalendarMinute contained /[0-5]\=[0-9]\|*/ 46 | syn match sdCalendarSecond contained /\%([0-5]\=[0-9]\|60\)\%(\.\d+\)\=\|\*/ 47 | syn match sdCalendarTZ contained /UTC\|\i\+\/\i\+/ 48 | syn match sdCalendar contained /\%([A-Za-z,.]\+\s+\)\=\%([0-9*.,/-]\+\%(\s\+[0-9*.,/:]\+\)\=\|[0-9*.,/:]\+\)\%(\s\+\w\+\/\w\+\)/ 49 | 50 | " Calendar examples, from systemd.time(7) 51 | " Sat,Thu,Mon..Wed,Sat..Sun → Mon..Thu,Sat,Sun *-*-* 00:00:00 52 | " Mon,Sun 12-*-* 2,1:23 → Mon,Sun 2012-*-* 01,02:23:00 53 | " Wed *-1 → Wed *-*-01 00:00:00 54 | " Wed..Wed,Wed *-1 → Wed *-*-01 00:00:00 55 | " Wed, 17:48 → Wed *-*-* 17:48:00 56 | " Wed..Sat,Tue 12-10-15 1:2:3 → Tue..Sat 2012-10-15 01:02:03 57 | " *-*-7 0:0:0 → *-*-07 00:00:00 58 | " 10-15 → *-10-15 00:00:00 59 | " monday *-12-* 17:00 → Mon *-12-* 17:00:00 60 | " Mon,Fri *-*-3,1,2 *:30:45 → Mon,Fri *-*-01,02,03 *:30:45 61 | " 12,14,13,12:20,10,30 → *-*-* 12,13,14:10,20,30:00 62 | " 12..14:10,20,30 → *-*-* 12..14:10,20,30:00 63 | " mon,fri *-1/2-1,3 *:30:45 → Mon,Fri *-01/2-01,03 *:30:45 64 | " 03-05 08:05:40 → *-03-05 08:05:40 65 | " 08:05:40 → *-*-* 08:05:40 66 | " 05:40 → *-*-* 05:40:00 67 | " Sat,Sun 12-05 08:05:40 → Sat,Sun *-12-05 08:05:40 68 | " Sat,Sun 08:05:40 → Sat,Sun *-*-* 08:05:40 69 | " 2003-03-05 05:40 → 2003-03-05 05:40:00 70 | " 05:40:23.4200004/3.1700005 → *-*-* 05:40:23.420000/3.170001 71 | " 2003-02..04-05 → 2003-02..04-05 00:00:00 72 | " 2003-03-05 05:40 UTC → 2003-03-05 05:40:00 UTC 73 | " 2003-03-05 → 2003-03-05 00:00:00 74 | " 03-05 → *-03-05 00:00:00 75 | " hourly → *-*-* *:00:00 76 | " daily → *-*-* 00:00:00 77 | " daily UTC → *-*-* 00:00:00 UTC 78 | " monthly → *-*-01 00:00:00 79 | " weekly → Mon *-*-* 00:00:00 80 | " weekly Pacific/Auckland → Mon *-*-* 00:00:00 Pacific/Auckland 81 | " yearly → *-01-01 00:00:00 82 | " annually → *-01-01 00:00:00 83 | " *:2/3 → *-*-* *:02/3:00 84 | 85 | 86 | syn match sdDatasize contained nextgroup=sdErr /\d\+[KMGT]/ 87 | syn match sdFilename contained nextgroup=sdErr /\/\S*/ 88 | syn match sdPercent contained nextgroup=sdErr /\d\+%/ 89 | syn keyword sdBool contained nextgroup=sdErr 1 yes true on 0 no false off 90 | syn match sdUnitName contained /\S\+\.\(automount\|mount\|swap\|socket\|service\|target\|path\|timer\|device\|slice\|scope\)\_s/ 91 | 92 | " Signal names generated with: 93 | " echo $(bash -c 'kill -l' | grep -o 'SIG[A-Z0-9]\+' | uniq) 94 | syn keyword sdSignalName contained SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGBUS SIGFPE SIGKILL SIGUSR1 SIGSEGV SIGUSR2 SIGPIPE SIGALRM SIGTERM SIGSTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ SIGVTALRM SIGPROF SIGWINCH SIGIO SIGPWR SIGSYS SIGRTMIN SIGRTMAX 95 | syn match sdSignal /SIG\w\+/ contained contains=sdSignalName,sdErr nextgroup=sdErr 96 | syn match sdSignalList /.\+/ contained contains=sdSignalName,sdByteVal,sdErrItem 97 | 98 | " generated with: echo $(systemd-analyze exit-status | awk '/[0-9]/ { print $1 }') 99 | syn keyword sdExitStatusName contained SUCCESS FAILURE INVALIDARGUMENT NOTIMPLEMENTED NOPERMISSION NOTINSTALLED NOTCONFIGURED NOTRUNNING USAGE DATAERR NOINPUT NOUSER NOHOST UNAVAILABLE SOFTWARE OSERR OSFILE CANTCREAT IOERR TEMPFAIL PROTOCOL NOPERM CONFIG CHDIR NICE FDS EXEC MEMORY LIMITS OOM_ADJUST SIGNAL_MASK STDIN STDOUT CHROOT IOPRIO TIMERSLACK SECUREBITS SETSCHEDULER CPUAFFINITY GROUP USER CAPABILITIES CGROUP SETSID CONFIRM STDERR PAM NETWORK NAMESPACE NO_NEW_PRIVILEGES SECCOMP SELINUX_CONTEXT PERSONALITY APPARMOR ADDRESS_FAMILIES RUNTIME_DIRECTORY CHOWN SMACK_PROCESS_LABEL KEYRING STATE_DIRECTORY CACHE_DIRECTORY LOGS_DIRECTORY CONFIGURATION_DIRECTORY NUMA_POLICY CREDENTIALS BPF EXCEPTION 100 | syn match sdExitStatusNum /\d\+/ contained contains=sdByteVal nextgroup=sdErr 101 | syn match sdExitStatus /\S\+/ contained contains=sdExitStatusName,sdExitStatusNum nextgroup=sdErr 102 | syn match sdExitStatusList /.*/ contained contains=sdExitStatusName,sdSignalName,sdByteVal,sdErrItem 103 | 104 | " type identifiers used in `systemd --dump-config`, from most to least common: 105 | " 189 OTHER 106 | " 179 BOOLEAN 107 | " 136 LIMIT 108 | " 46 CONDITION 109 | " 36 WEIGHT 110 | " 30 MODE 111 | " 27 PATH 112 | " 25 PATH [...] 113 | " 24 SECONDS, STRING 114 | " 20 SIGNAL 115 | " 15 UNIT [...] 116 | " 12 BANDWIDTH, DEVICEWEIGHT, SHARES, UNSIGNED 117 | " 11 PATH [ARGUMENT [...]] 118 | " 8 BOUNDINGSET, LEVEL, OUTPUT, PATH[:PATH[:OPTIONS]] [...], SOCKET [...] 119 | " 6 ACTION, DEVICE, DEVICELATENCY, POLICY, SLICE, TIMER 120 | " 5 KILLMODE 121 | " 4 ARCHS, CPUAFFINITY, CPUSCHEDPOLICY, CPUSCHEDPRIO, ENVIRON, ERRNO, FACILITY, FAMILIES, FILE, INPUT, IOCLASS, IOPRIORITY, LABEL, MOUNTFLAG [...], NAMESPACES, NANOSECONDS, NICE, NOTSUPPORTED, OOMSCOREADJUST, PERSONALITY, SECUREBITS, SYSCALLS 122 | " 3 INTEGER, SIZE, STATUS 123 | " 2 LONG, UNIT 124 | " 1 ACCESS, NETWORKINTERFACE, SERVICE, SERVICERESTART, SERVICETYPE, SOCKETBIND, SOCKETS, TOS, URL 125 | 126 | 127 | " .include 128 | syn match sdInclude /^.include/ nextgroup=sdFilename 129 | 130 | " comments 131 | syn match sdComment /^[;#].*/ contains=sdTodo containedin=ALL 132 | syn keyword sdTodo contained TODO XXX FIXME NOTE 133 | 134 | " [Unit] {{{1 135 | " see systemd.unit(5) 136 | syn region sdUnitBlock matchgroup=sdHeader start=/^\[Unit\]/ end=/^\[/me=e-2 contains=sdUnitKey 137 | syn match sdUnitKey contained /^Description=/ 138 | syn match sdUnitKey contained /^Documentation=/ nextgroup=sdDocURI 139 | syn match sdUnitKey contained /^SourcePath=/ nextgroup=sdFilename,sdErr 140 | syn match sdUnitKey contained /^\%(Requires\|RequiresOverridable\|Requisite\|RequisiteOverridable\|Wants\|Binds\=To\|PartOf\|Conflicts\|Before\|After\|OnFailure\|Names\|Propagates\=ReloadTo\|ReloadPropagatedFrom\|PropagateReloadFrom\|JoinsNamespaceOf\)=/ nextgroup=sdUnitList 141 | syn match sdUnitKey contained /^\%(OnFailureIsolate\|IgnoreOnIsolate\|IgnoreOnSnapshot\|StopWhenUnneeded\|RefuseManualStart\|RefuseManualStop\|AllowIsolate\|DefaultDependencies\)=/ nextgroup=sdBool,sdErr 142 | syn match sdUnitKey contained /^OnFailureJobMode=/ nextgroup=sdFailJobMode,sdErr 143 | syn match sdUnitKey contained /^\%(StartLimitInterval\|StartLimitIntervalSec\|JobTimeoutSec\)=/ nextgroup=sdDuration,sdErr 144 | syn match sdUnitKey contained /^\%(StartLimitAction\|JobTimeoutAction\)=/ nextgroup=sdLimitAction,sdErr 145 | syn match sdUnitKey contained /^StartLimitBurst=/ nextgroup=sdUInt,sdErr 146 | syn match sdUnitKey contained /^\%(FailureAction\|SuccessAction\)=/ nextgroup=sdLimitAction,sdFailAction,sdErr 147 | syn match sdUnitKey contained /^\%(FailureAction\|SuccessAction\)ExitStatus=/ nextgroup=sdExitStatusNum,sdErr 148 | syn match sdUnitKey contained /^\%(RebootArgument\|JobTimeoutRebootArgument\)=/ 149 | syn match sdUnitKey contained /^RequiresMountsFor=/ nextgroup=sdFileList,sdErr 150 | " TODO: JobRunningTimeoutSec 151 | " ConditionXXX/AssertXXX. Note that they all have an optional '|' after the '='. 152 | syn match sdUnitKey contained /^\%(Condition\|Assert\)\(PathExists\|PathExistsGlob\|PathIsDirectory\|PathIsMountPoint\|PathIsReadWrite\|PathIsSymbolicLink\|DirectoryNotEmpty\|FileNotEmpty\|FileIsExecutable\)=|\=!\=/ contains=sdConditionFlag nextgroup=sdFilename,sdErr 153 | syn match sdUnitKey contained /^\%(Condition\|Assert\)Virtualization=|\=!\=/ contains=sdConditionFlag nextgroup=sdVirtType,sdErr 154 | syn match sdUnitKey contained /^\%(Condition\|Assert\)Security=|\=!\=/ contains=sdConditionFlag nextgroup=sdSecurityType,sdErr 155 | syn match sdUnitKey contained /^\%(Condition\|Assert\)Capability=|\=!\=/ contains=sdConditionFlag nextgroup=sdAnyCapName,sdErr 156 | syn match sdUnitKey contained /^\%(Condition\|Assert\)\%(KernelCommandLine\|Host\)=|\=!\=/ contains=sdConditionFlag 157 | syn match sdUnitKey contained /^\%(Condition\|Assert\)\%(ACPower\|Null\|FirstBoot\)=|\=/ contains=sdConditionFlag nextgroup=sdBool,sdErr 158 | syn match sdUnitKey contained /^\%(Condition\|Assert\)NeedsUpdate=|\=!\=/ contains=sdConditionFlag nextgroup=sdCondUpdateDir,sdErr 159 | syn match sdUnitKey contained /^\%(Condition\|Assert\)Architecture=|\=!\=/ contains=sdConditionFlag nextgroup=sdArch,sdErr 160 | syn match sdUnitKey contained /^\%(Condition\|Assert\)User=|\=/ contains=sdConditionFlag nextgroup=sdUser,sdCondUser,sdErr 161 | syn match sdUnitKey contained /^\%(Condition\|Assert\)Group=|\=/ contains=sdConditionFlag nextgroup=sdUser,sdErr 162 | syn match sdUnitKey contained /^\%(Condition\|Assert\)ControlGroupController=|\=/ contains=sdConditionFlag nextgroup=sdController,sdErr 163 | syn match sdUnitKey contained /^\%(Condition\|Assert\)KernelVersion=|\=/ contains=sdConditionFlag nextgroup=sdKernelVersion,sdErr 164 | 165 | " extra bits 166 | syn match sdUnit contained /\S\+/ contains=sdUnitName,sdErr nextgroup=sdErr 167 | syn match sdUnitList contained /.\+/ contains=sdUnitName,sdErr 168 | syn match sdConditionFlag contained /[!|]/ 169 | syn match sdCondUpdateDir contained nextgroup=sdErr /\%(\/etc\|\/var\)/ 170 | syn keyword sdVirtType contained nextgroup=sdErr vm container qemu kvm zvm vmware microsoft oracle xen bochs uml bhyve qnx openvz openvz lxc lxc-libvirt systemd-nspawn docker podman rkt wsl acrn private-users 171 | syn keyword sdSecurityType contained nextgroup=sdErr selinux apparmor tomoyo ima smack audit uefi-secureboot 172 | syn keyword sdFailJobMode contained nextgroup=sdErr fail replace replace-irreversibly 173 | syn keyword sdLimitAction contained nextgroup=sdErr none reboot reboot-force reboot-immediate poweroff poweroff-force poweroff-immediate 174 | syn keyword sdFailAction contained nextgroup=sdErr exit exit-force 175 | syn keyword sdArch contained nextgroup=sdErr x86 x86_64 ppc ppc-le ppc64 ppc64-le ia64 parisc parisc64 s390 s390x sparc sparc64 mips mips-le mips64 mips64-le alpha arm arm-be arm64 arm64-be sh sh64 m68k tilegx cris arc arc-be native 176 | syn keyword sdController contained cpu cpuacct io blkio memory devices pids nextgroup=sdController,sdErr 177 | syn match sdCondUser contained /@system/ 178 | syn match sdUser contained nextgroup=sdErr /\d\+\|[A-Za-z_][A-Za-z0-9_-]*/ 179 | syn match sdDocUri contained /\%(https\=:\/\/\|file:\|info:\|man:\)\S\+\s*/ nextgroup=sdDocUri,sdErr 180 | 181 | " [Install] {{{1 182 | " see systemd.unit(5) 183 | syn region sdInstallBlock matchgroup=sdHeader start=/^\[Install\]/ end=/^\[/me=e-2 contains=sdInstallKey 184 | syn match sdInstallKey contained /^\%(WantedBy\|Alias\|Also\|RequiredBy\)=/ nextgroup=sdUnitList 185 | syn match sdInstallKey contained /^DefaultInstance=/ nextgroup=sdInstance 186 | " TODO: sdInstance - what's valid there? probably [^@/]\+, but that's a guess 187 | 188 | " Execution options common to [Service|Socket|Mount|Swap] {{{1 189 | " see systemd.exec(5) 190 | syn match sdExecKey contained /^Exec\%(Start\%(Pre\|Post\|\)\|Reload\|Stop\|StopPost\|Condition\)=/ nextgroup=sdExecFlag,sdExecFile,sdErr 191 | syn match sdExecKey contained /^\%(WorkingDirectory\|RootDirectory\|TTYPath\|RootImage\)=/ nextgroup=sdFilename,sdErr 192 | syn match sdExecKey contained /^\%(Runtime\|State\|Cache\|Logs\|Configuration\)Directory=/ nextgroup=sdFilename,sdErr 193 | syn match sdExecKey contained /^\%(Runtime\|State\|Cache\|Logs\|Configuration\)DirectoryMode=/ nextgroup=sdOctal,sdErr 194 | syn match sdExecKey contained /^User=/ nextgroup=sdUser,sdErr 195 | syn match sdExecKey contained /^Group=/ nextgroup=sdUser,sdErr 196 | " TODO: NUMAPolicy, NUMAMask 197 | " TODO: Pass/UnsetEnvironment 198 | " TODO: StandardInput\%(Text\|Data\) 199 | " TODO: Generally everything from 'WorkingDirectory' on down 200 | " TODO: handle some of these better 201 | " FIXME: some of these have moved to Resource Control 202 | " CPUAffinity is: list of uint 203 | " BlockIOWeight is: uint\|filename uint 204 | " BlockIO\%(Read\|Write\)Bandwidth is: filename datasize 205 | syn match sdExecKey contained /^\%(SupplementaryGroups\|CPUAffinity\|SyslogIdentifier\|PAMName\|TCPWrapName\|ControlGroup\|ControlGroupAttribute\|UtmpIdentifier\)=/ 206 | syn match sdExecKey contained /^Limit\%(CPU\|FSIZE\|DATA\|STACK\|CORE\|RSS\|NOFILE\|AS\|NPROC\|MEMLOCK\|LOCKS\|SIGPENDING\|MSGQUEUE\|NICE\|RTPRIO\|RTTIME\)=/ nextgroup=sdRlimit 207 | syn match sdExecKey contained /^\%(CPUSchedulingResetOnFork\|TTYReset\|TTYVHangup\|TTYVTDisallocate\|SyslogLevelPrefix\|ControlGroupModify\|DynamicUser\|RemoveIPC\|NoNewPrivileges\|RestrictRealtime\|RestrictSUIDSGID\|LockPersonality\|MountAPIVFS\)=/ nextgroup=sdBool,sdErr 208 | syn match sdExecKey contained /^Private\%(Tmp\|Network\|Devices\|Users\|Mounts\)=/ nextgroup=sdBool,sdErr 209 | syn match sdExecKey contained /^Protect\%(KernelTunables\|KernelModules\|KernelLogs\|Clock\|ControlGroups\|Hostname\)=/ nextgroup=sdBool,sdErr 210 | syn match sdExecKey contained /^\%(Nice\|OOMScoreAdjust\)=/ nextgroup=sdInt,sdErr 211 | syn match sdExecKey contained /^\%(CPUSchedulingPriority\|TimerSlackNSec\)=/ nextgroup=sdUInt,sdErr 212 | " 'ReadOnlyDirectories' et al. are obsolete versions of ReadOnlyPaths' et al. 213 | syn match sdExecKey contained /^\%(ReadWrite\|ReadOnly\|Inaccessible\)Directories=/ nextgroup=sdFileList 214 | syn match sdExecKey contained /^\%(ReadWrite\|ReadOnly\|Inaccessible\|Exec\|NoExec\)Paths=/ nextgroup=sdExecPathList 215 | syn match sdExecKey contained /^CapabilityBoundingSet=/ nextgroup=sdCapNameList 216 | syn match sdExecKey contained /^Capabilities=/ nextgroup=sdCapability,sdErr 217 | syn match sdExecKey contained /^UMask=/ nextgroup=sdOctal,sdErr 218 | syn match sdExecKey contained /^StandardInput=/ nextgroup=sdStdin,sdErr 219 | syn match sdExecKey contained /^Standard\%(Output\|Error\)=/ nextgroup=sdStdout,sdErr 220 | syn match sdExecKey contained /^SecureBits=/ nextgroup=sdSecureBitList 221 | syn match sdExecKey contained /^SyslogFacility=/ nextgroup=sdSyslogFacil,sdErr 222 | syn match sdExecKey contained /^SyslogLevel=/ nextgroup=sdSyslogLevel,sdErr 223 | syn match sdExecKey contained /^IOSchedulingClass=/ nextgroup=sdIOSchedClass,sdErr 224 | syn match sdExecKey contained /^IOSchedulingPriority=/ nextgroup=sdIOSchedPrio,sdErr 225 | syn match sdExecKey contained /^CPUSchedulingPolicy=/ nextgroup=sdCPUSchedPol,sdErr 226 | syn match sdExecKey contained /^MountFlags=/ nextgroup=sdMountFlags,sdErr 227 | syn match sdExecKey contained /^\%(IgnoreSIGPIPE\|MemoryDenyWriteExecute\)=/ nextgroup=sdBool,sdErr 228 | syn match sdExecKey contained /^Environment=/ nextgroup=sdEnvDefs 229 | syn match sdExecKey contained /^EnvironmentFile=-\=/ contains=sdEnvDashFlag nextgroup=sdFilename,sdErr 230 | 231 | syn match sdExecFlag contained /-\=@\=/ nextgroup=sdExecFile,sdErr 232 | syn match sdExecFile contained /\S\+/ nextgroup=sdExecArgs 233 | syn match sdExecArgs contained /.*/ contains=sdEnvArg 234 | syn match sdEnvDefs contained /.*/ contains=sdEnvDef 235 | syn match sdEnvDashFlag contained /-/ nextgroup=sdFilename,sdErr 236 | syn match sdEnvDef contained /\i\+=/he=e-1 237 | syn match sdFileList contained /.*/ contains=sdFilename,sdErr 238 | syn match sdExecPathList contained /.*/ contains=sdExecPath,sdErr 239 | syn match sdExecPath contained /-\=+\=\/\S\+\s*/ 240 | " CAPABILITIES WOOO {{{ 241 | syn case ignore 242 | syn match sdCapNameList contained /.*/ contains=sdAnyCapName,sdErr 243 | syn match sdAnyCapName contained /CAP_[A-Z_]\+\s*/ contains=sdCapName 244 | syn keyword sdCapName contained CAP_AUDIT_CONTROL CAP_AUDIT_WRITE CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH 245 | syn keyword sdCapName contained CAP_FOWNER CAP_FSETID CAP_IPC_LOCK CAP_IPC_OWNER CAP_KILL CAP_LEASE 246 | syn keyword sdCapName contained CAP_LINUX_IMMUTABLE CAP_MAC_ADMIN CAP_MAC_OVERRIDE CAP_MKNOD 247 | syn keyword sdCapName contained CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW 248 | syn keyword sdCapName contained CAP_SETGID CAP_SETFCAP CAP_SETPCAP CAP_SETUID 249 | syn keyword sdCapName contained CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_CHROOT CAP_SYS_MODULE CAP_SYS_NICE CAP_SYS_PACCT 250 | syn keyword sdCapName contained CAP_SYS_PTRACE CAP_SYS_RAWIO CAP_SYS_RESOURCE CAP_SYS_TIME CAP_SYS_TTY_CONFIG 251 | syn case match 252 | syn cluster sdCap contains=sdCapName,sdCapOps,sdCapFlags 253 | syn match sdCapOps contained /[=+-]/ 254 | syn match sdCapFlags contained /\<[eip]\+/ 255 | syn match sdCapability contained /\%(\%([A-Za-z_]\+,\=\)*\|all\)\%(=[eip]*\|[+-][eip]\+\)\s*/ contains=@sdCap nextgroup=sdCapability,sdErr 256 | "}}} 257 | syn keyword sdStdin contained nextgroup=sdErr null tty-force tty-fail socket tty 258 | syn match sdStdout contained nextgroup=sdErr /\%(syslog\|kmsg\|journal\)\%(+console\)\=/ 259 | syn keyword sdStdout contained nextgroup=sdErr inherit null tty socket 260 | syn keyword sdSyslogFacil contained nextgroup=sdErr kern user mail daemon auth syslog lpr news uucp cron authpriv ftp 261 | syn match sdSyslogFacil contained nextgroup=sdErr /\/ 262 | syn keyword sdSyslogLevel contained nextgroup=sdErr emerg alert crit err warning notice info debug 263 | syn keyword sdIOSchedClass contained nextgroup=sdErr 0 1 2 3 none realtime best-effort idle 264 | syn keyword sdIOSchedPrio contained nextgroup=sdErr 0 1 2 3 4 5 6 7 265 | syn keyword sdCPUSchedPol contained nextgroup=sdErr other batch idle fifo rr 266 | syn keyword sdMountFlags contained nextgroup=sdErr shared slave private 267 | syn match sdRlimit contained nextgroup=sdErr /\<\%(\d\+\|infinity\)\>/ 268 | syn keyword sdSecureBits contained nextgroup=sdErr keep-caps keep-caps-locked noroot noroot-locked no-setuid-fixup no-setuid-fixup-locked 269 | 270 | " TODO: which section does this come from? 271 | syn match sdExecKey contained /^TimeoutSec=/ nextgroup=sdDuration,sdErr 272 | 273 | " Process killing options for [Service|Socket|Mount|Swap|Scope] {{{1 274 | " see systemd.kill(5) 275 | syn match sdKillKey contained /^KillSignal=/ nextgroup=sdSignal,sdErr 276 | syn match sdKillKey contained /^KillMode=/ nextgroup=sdKillMode,sdErr 277 | syn match sdKillKey contained /^\%(SendSIGKILL\|SendSIGHUP\)=/ nextgroup=sdBool,sdErr 278 | syn keyword sdKillMode contained nextgroup=sdErr control-group process mixed none 279 | 280 | " Resource Control options for [Service|Socket|Mount|Swap|Slice|Scope] {{{1 281 | " see systemd.resource-control(5) 282 | syn match sdResCtlKey contained /^Slice=/ nextgroup=sdSliceName,sdErr 283 | syn match sdResCtlKey contained /^\%(CPUAccounting\|MemoryAccounting\|IOAccounting\|BlockIOAccounting\|TasksAccounting\|IPAccounting\|Delegate\)=/ nextgroup=sdBool,sdErr 284 | syn match sdResCtlKey contained /^\%(CPUQuota\)=/ nextgroup=sdPercent,sdErr 285 | syn match sdResCtlKey contained /^\%(CPUShares\|StartupCPUShares\)=/ nextgroup=sdUInt,sdErr 286 | syn match sdResCtlKey contained /^MemoryLow=/ nextgroup=sdDatasize,sdPercent,sdErr 287 | syn match sdResCtlKey contained /^\%(MemoryLimit\|MemoryHigh\|MemoryMax\)=/ nextgroup=sdDatasize,sdPercent,sdInfinity,sdErr 288 | syn match sdResCtlKey contained /^TasksMax=/ nextgroup=sdUInt,sdInfinity,sdErr 289 | syn match sdResCtlKey contained /^\%(IOWeight\|StartupIOWeight\|BlockIOWeight\|StartupBlockIOWeight\)=/ nextgroup=sdUInt,sdErr 290 | syn match sdResCtlKey contained /^DeviceAllow=/ nextgroup=sdDevAllow,sdErr 291 | syn match sdResCtlKey contained /^DevicePolicy=/ nextgroup=sdDevPolicy,sdErr 292 | 293 | syn match sdSliceName contained /\S\+\.slice\_s/ contains=sdUnitName 294 | syn keyword sdInfinity contained infinity 295 | 296 | syn match sdDevAllow contained /\%(\/dev\/\|char-\|block-\)\S\+\s\+/ nextgroup=sdDevAllowPerm 297 | syn match sdDevAllowPerm contained /\S\+/ contains=sdDevAllowErr nextgroup=sdErr 298 | syn match sdDevAllowErr contained /[^rwm]\+/ 299 | syn keyword sdDevPolicy contained strict closed auto 300 | 301 | " [Service] {{{1 302 | syn region sdServiceBlock matchgroup=sdHeader start=/^\[Service\]/ end=/^\[/me=e-2 contains=sdServiceKey,sdExecKey,sdKillKey,sdResCtlKey 303 | syn match sdServiceKey contained /^BusName=/ 304 | syn match sdServiceKey contained /^\%(RemainAfterExit\|GuessMainPID\|PermissionsStartOnly\|RootDirectoryStartOnly\|NonBlocking\|ControlGroupModify\)=/ nextgroup=sdBool,sdErr 305 | syn match sdServiceKey contained /^\%(SysVStartPriority\|FsckPassNo\)=/ nextgroup=sdUInt,sdErr 306 | syn match sdServiceKey contained /^\%(Restart\|Timeout\|TimeoutStart\|TimeoutStop\|TimeoutAbort\|Watchdog\|RuntimeMax\)Sec=/ nextgroup=sdDuration,sdErr 307 | syn match sdServiceKey contained /^Sockets=/ nextgroup=sdUnitList 308 | syn match sdServiceKey contained /^PIDFile=/ nextgroup=sdFilename,sdErr 309 | syn match sdServiceKey contained /^Type=/ nextgroup=sdServiceType,sdErr 310 | syn match sdServiceKey contained /^Restart=/ nextgroup=sdRestartType,sdErr 311 | syn match sdServiceKey contained /^NotifyAccess=/ nextgroup=sdNotifyType,sdErr 312 | syn match sdServiceKey contained /^StartLimitInterval=/ nextgroup=sdDuration,sdErr 313 | syn match sdServiceKey contained /^StartLimitAction=/ nextgroup=sdLimitAction,sdErr 314 | syn match sdServiceKey contained /^StartLimitBurst=/ nextgroup=sdUInt,sdErr 315 | syn match sdServiceKey contained /^FailureAction=/ nextgroup=sdLimitAction,sdFailAction,sdErr 316 | syn match sdServiceKey contained /^\%(RestartPrevent\|RestartForce\)ExitStatus=/ nextgroup=sdSignalList 317 | syn match sdServiceKey contained /^SuccessExitStatus=/ nextgroup=sdExitStatusList 318 | syn match sdServiceKey contained /^RebootArgument=/ 319 | syn keyword sdServiceType contained nextgroup=sdErr simple exec forking dbus oneshot notify idle 320 | syn keyword sdRestartType contained nextgroup=sdErr no on-success on-failure on-abort always 321 | syn keyword sdNotifyType contained nextgroup=sdErr none main all 322 | 323 | " [Socket] {{{1 324 | syn region sdSocketBlock matchgroup=sdHeader start=/^\[Socket\]/ end=/^\[/me=e-2 contains=sdSocketKey,sdExecKey,sdKillKey,sdResCtlKey 325 | syn match sdSocketKey contained /^Listen\%(Stream\|Datagram\|SequentialPacket\|FIFO\|Special\|Netlink\|MessageQueue\)=/ 326 | syn match sdSocketKey contained /^Listen\%(FIFO\|Special\)=/ nextgroup=sdFilename,sdErr 327 | syn match sdSocketKey contained /^\%(Socket\|Directory\)Mode=/ nextgroup=sdOctal,sdErr 328 | syn match sdSocketKey contained /^\%(Backlog\|MaxConnections\|Priority\|ReceiveBuffer\|SendBuffer\|IPTTL\|Mark\|PipeSize\|MessageQueueMaxMessages\|MessageQueueMessageSize\)=/ nextgroup=sdUInt,sdErr 329 | syn match sdSocketKey contained /^\%(Accept\|KeepAlive\|FreeBind\|Transparent\|Broadcast\|Writable\|NoDelay\|PassCredentials\|PassSecurity\|ReusePort\|RemoveOnStop\|SELinuxContextFromNet\)=/ nextgroup=sdBool,sdErr 330 | syn match sdSocketKey contained /^BindToDevice=/ 331 | syn match sdSocketKey contained /^Service=/ nextgroup=sdUnit 332 | syn match sdSocketKey contained /^BindIPv6Only=/ nextgroup=sdBindIPv6,sdErr 333 | syn match sdSocketKey contained /^IPTOS=/ nextgroup=sdIPTOS,sdUInt,sdErr 334 | syn match sdSocketKey contained /^TCPCongestion=/ nextgroup=sdTCPCongest 335 | syn keyword sdBindIPv6 contained nextgroup=sdErr default both ipv6-only 336 | syn keyword sdIPTOS contained nextgroup=sdErr low-delay throughput reliability low-cost 337 | syn keyword sdTCPCongest contained nextgroup=sdErr westwood veno cubic lp 338 | 339 | " [Timer|Automount|Mount|Swap|Path|Slice|Scope] {{{1 340 | " [Timer] 341 | syn region sdTimerBlock matchgroup=sdHeader start=/^\[Timer\]/ end=/^\[/me=e-2 contains=sdTimerKey 342 | syn match sdTimerKey contained /^On\%(Active\|Boot\|Startup\|UnitActive\|UnitInactive\)Sec=/ nextgroup=sdDuration,sdErr 343 | syn match sdTimerKey contained /^\%(Accuracy\|RandomizedDelay\)Sec=/ nextgroup=sdDuration,sdErr 344 | syn match sdTimerKey contained /^\%(Persistent\|WakeSystem\|RemainAfterElapse\|OnClockChange\|OnTimezoneChange\)=/ nextgroup=sdBool,sdErr 345 | syn match sdTimerKey contained /^OnCalendar=/ nextgroup=sdCalendar 346 | syn match sdTimerKey contained /^Unit=/ nextgroup=sdUnitList 347 | " TODO: sdCalendar 348 | 349 | " [Automount] 350 | syn region sdAutoMountBlock matchgroup=sdHeader start=/^\[Automount\]/ end=/^\[/me=e-2 contains=sdAutomountKey 351 | syn match sdAutomountKey contained /^Where=/ nextgroup=sdFilename,sdErr 352 | syn match sdAutomountKey contained /^DirectoryMode=/ nextgroup=sdOctal,sdErr 353 | 354 | " [Mount] 355 | syn region sdMountBlock matchgroup=sdHeader start=/^\[Mount\]/ end=/^\[/me=e-2 contains=sdMountKey,sdAutomountKey,sdExecKey,sdKillKey,sdResCtlKey 356 | syn match sdMountKey contained /^\%(SloppyOptions\|LazyUnmount\|ForceUnmount\)=/ nextgroup=sdBool,sdErr 357 | syn match sdMountKey contained /^\%(What\|Type\|Options\)=/ 358 | 359 | " [Swap] 360 | syn region sdSwapBlock matchgroup=sdHeader start=/^\[Swap\]/ end=/^\[/me=e-2 contains=sdSwapKey,sdExecKey,sdKillKey,sdResCtlKey 361 | syn match sdSwapKey contained /^What=/ nextgroup=sdFilename,sdErr 362 | syn match sdSwapKey contained /^Priority=/ nextgroup=sdUInt,sdErr 363 | syn match sdSwapKey contained /^Options=/ 364 | 365 | " [Path] 366 | syn region sdPathBlock matchgroup=sdHeader start=/^\[Path\]/ end=/^\[/me=e-2 contains=sdPathKey 367 | syn match sdPathKey contained /^\%(PathExists\|PathExistsGlob\|PathChanged\|PathModified\|DirectoryNotEmpty\)=/ nextgroup=sdFilename,sdErr 368 | syn match sdPathKey contained /^MakeDirectory=/ nextgroup=sdBool,sdErr 369 | syn match sdPathKey contained /^DirectoryMode=/ nextgroup=sdOctal,sdErr 370 | syn match sdPathKey contained /^Unit=/ nextgroup=sdUnitList 371 | 372 | " [Slice] 373 | syn region sdSliceBlock matchgroup=sdHeader start=/^\[Slice\]/ end=/^\[/me=e-2 contains=sdSliceKey,sdResCtlKey,sdKillKey 374 | 375 | " [Scope] 376 | syn region sdScopeBlock matchgroup=sdHeader start=/^\[Scope\]/ end=/^\[/me=e-2 contains=sdScopeKey,sdResCtlKey,sdKillKey 377 | syn match sdScopeKey contained /^TimeoutStopSec=/ nextgroup=sdDuration,sdErr 378 | 379 | 380 | " Coloring definitions {{{1 381 | hi def link sdComment Comment 382 | hi def link sdTodo Todo 383 | hi def link sdInclude PreProc 384 | hi def link sdHeader Type 385 | hi def link sdEnvArg PreProc 386 | hi def link sdFormatStr Special 387 | hi def link sdErr Error 388 | hi def link sdEnvDef Identifier 389 | hi def link sdUnitName PreProc 390 | hi def link sdKey Statement 391 | hi def link sdValue Constant 392 | hi def link sdSymbol Special 393 | 394 | " Coloring links: keys {{{1 395 | 396 | " It'd be nice if this worked.. 397 | "hi def link sd.\+Key sdKey 398 | hi def link sdUnitKey sdKey 399 | hi def link sdInstallKey sdKey 400 | hi def link sdExecKey sdKey 401 | hi def link sdKillKey sdKey 402 | hi def link sdResCtlKey sdKey 403 | hi def link sdSocketKey sdKey 404 | hi def link sdServiceKey sdKey 405 | hi def link sdServiceCommonKey sdKey 406 | hi def link sdTimerKey sdKey 407 | hi def link sdMountKey sdKey 408 | hi def link sdAutomountKey sdKey 409 | hi def link sdSwapKey sdKey 410 | hi def link sdPathKey sdKey 411 | hi def link sdScopeKey sdKey 412 | 413 | " Coloring links: constant values {{{1 414 | hi def link sdInt sdValue 415 | hi def link sdUInt sdValue 416 | hi def link sdBool sdValue 417 | hi def link sdOctal sdValue 418 | hi def link sdByteVal sdValue 419 | hi def link sdDuration sdValue 420 | hi def link sdPercent sdValue 421 | hi def link sdInfinity sdValue 422 | hi def link sdDatasize sdValue 423 | hi def link sdVirtType sdValue 424 | hi def link sdServiceType sdValue 425 | hi def link sdNotifyType sdValue 426 | hi def link sdSecurityType sdValue 427 | hi def link sdSecureBits sdValue 428 | hi def link sdMountFlags sdValue 429 | hi def link sdKillMode sdValue 430 | hi def link sdFailJobMode sdValue 431 | hi def link sdLimitAction sdValue 432 | hi def link sdRestartType sdValue 433 | hi def link sdSignalName sdValue 434 | hi def link sdExitStatusName sdValue 435 | hi def link sdStdin sdValue 436 | hi def link sdStdout sdValue 437 | hi def link sdSyslogFacil sdValue 438 | hi def link sdSyslogLevel sdValue 439 | hi def link sdIOSched sdValue 440 | hi def link sdCPUSched sdValue 441 | hi def link sdRlimit sdValue 442 | hi def link sdCapName sdValue 443 | hi def link sdDevPolicy sdValue 444 | hi def link sdDevAllowPerm sdValue 445 | hi def link sdDevAllowErr Error 446 | 447 | " Coloring links: symbols/flags {{{1 448 | hi def link sdExecFlag sdSymbol 449 | hi def link sdConditionFlag sdSymbol 450 | hi def link sdEnvDashFlag sdSymbol 451 | hi def link sdCapOps sdSymbol 452 | hi def link sdCapFlags Identifier 453 | "}}} 454 | 455 | let b:current_syntax = "systemd" 456 | " vim: fdm=marker 457 | --------------------------------------------------------------------------------