Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: passwd(5) password file |
Bram Moolenaar | 57657d8 | 2006-04-21 22:12:41 +0000 | [diff] [blame] | 3 | " Maintainer: Nikolai Weibull <now@bitwi.se> |
Bram Moolenaar | 2b64440 | 2007-05-10 17:56:19 +0000 | [diff] [blame] | 4 | " Latest Revision: 2006-10-03 |
Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 5 | |
| 6 | if exists("b:current_syntax") |
| 7 | finish |
| 8 | endif |
| 9 | |
| 10 | let s:cpo_save = &cpo |
| 11 | set cpo&vim |
| 12 | |
| 13 | syn match passwdBegin display '^' nextgroup=passwdAccount |
| 14 | |
Bram Moolenaar | 2b64440 | 2007-05-10 17:56:19 +0000 | [diff] [blame] | 15 | syn match passwdAccount contained display '[^:]\+' |
Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 16 | \ nextgroup=passwdPasswordColon |
| 17 | |
| 18 | syn match passwdPasswordColon contained display ':' |
| 19 | \ nextgroup=passwdPassword,passwdShadow |
| 20 | |
| 21 | syn match passwdPassword contained display '[^:]\+' |
| 22 | \ nextgroup=passwdUIDColon |
| 23 | |
| 24 | syn match passwdShadow contained display '[x*!]' |
| 25 | \ nextgroup=passwdUIDColon |
| 26 | |
| 27 | syn match passwdUIDColon contained display ':' nextgroup=passwdUID |
| 28 | |
Bram Moolenaar | 2b64440 | 2007-05-10 17:56:19 +0000 | [diff] [blame] | 29 | syn match passwdUID contained display '\d\{0,10}' |
Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 30 | \ nextgroup=passwdGIDColon |
| 31 | |
| 32 | syn match passwdGIDColon contained display ':' nextgroup=passwdGID |
| 33 | |
Bram Moolenaar | 2b64440 | 2007-05-10 17:56:19 +0000 | [diff] [blame] | 34 | syn match passwdGID contained display '\d\{0,10}' |
Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 35 | \ nextgroup=passwdGecosColon |
| 36 | |
| 37 | syn match passwdGecosColon contained display ':' nextgroup=passwdGecos |
| 38 | |
| 39 | syn match passwdGecos contained display '[^:]*' |
| 40 | \ nextgroup=passwdDirColon |
| 41 | |
| 42 | syn match passwdDirColon contained display ':' nextgroup=passwdDir |
| 43 | |
| 44 | syn match passwdDir contained display '/[^:]*' |
| 45 | \ nextgroup=passwdShellColon |
| 46 | |
| 47 | syn match passwdShellColon contained display ':' |
| 48 | \ nextgroup=passwdShell |
| 49 | |
Bram Moolenaar | 57657d8 | 2006-04-21 22:12:41 +0000 | [diff] [blame] | 50 | syn match passwdShell contained display '.*' |
Bram Moolenaar | 0dc065e | 2005-07-04 22:49:24 +0000 | [diff] [blame] | 51 | |
| 52 | hi def link passwdColon Normal |
| 53 | hi def link passwdAccount Identifier |
| 54 | hi def link passwdPasswordColon passwdColon |
| 55 | hi def link passwdPassword Number |
| 56 | hi def link passwdShadow Special |
| 57 | hi def link passwdUIDColon passwdColon |
| 58 | hi def link passwdUID Number |
| 59 | hi def link passwdGIDColon passwdColon |
| 60 | hi def link passwdGID Number |
| 61 | hi def link passwdGecosColon passwdColon |
| 62 | hi def link passwdGecos Comment |
| 63 | hi def link passwdDirColon passwdColon |
| 64 | hi def link passwdDir Type |
| 65 | hi def link passwdShellColon passwdColon |
| 66 | hi def link passwdShell Operator |
| 67 | |
| 68 | let b:current_syntax = "passwd" |
| 69 | |
| 70 | let &cpo = s:cpo_save |
| 71 | unlet s:cpo_save |