robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Christian Clasonvim-patch:807fff135d529b9dab622a

master
6.2 KiB140 linesraw
1" Vim syntax file
2" Language:             pam(8) configuration file
3" Previous Maintainer:  Nikolai Weibull <now@bitwi.se>
4" Latest Change:        2024/03/31
5" Changes By:		Haochen Tong
6" 			Vim Project for the @include syntax
7
8if exists("b:current_syntax")
9  finish
10endif
11
12let s:cpo_save = &cpo
13set cpo&vim
14
15let s:has_service_field = exists("b:pamconf_has_service_field")
16      \ ? b:pamconf_has_service_field
17      \ : expand('%:t') == 'pam.conf' ? 1 : 0
18
19syn match   pamconfType             '-\?[[:alpha:]]\+'
20                                    \ contains=pamconfTypeKeyword
21                                    \ nextgroup=pamconfControl,
22                                    \ pamconfTypeLineCont skipwhite
23
24syn keyword pamconfTypeKeyword      contained account auth password session
25
26" The @include syntax is Debian specific
27syn match   pamconfInclude         '^@include'
28                                    \ nextgroup=pamconfIncludeFile
29                                    \ skipwhite
30
31syn match   pamconfIncludeFile     '\f\+$'
32
33if s:has_service_field
34    syn match   pamconfService          '^[[:graph:]]\+'
35                                        \ nextgroup=pamconfType,
36                                        \ pamconfServiceLineCont skipwhite
37
38    syn match   pamconfServiceLineCont  contained '\\$'
39                                        \ nextgroup=pamconfType,
40                                        \ pamconfServiceLineCont skipwhite skipnl
41endif
42
43syn keyword pamconfTodo             contained TODO FIXME XXX NOTE
44
45syn region  pamconfComment          display oneline start='#' end='$'
46                                    \ contains=pamconfTodo,@Spell
47
48syn match   pamconfTypeLineCont     contained '\\$'
49                                    \ nextgroup=pamconfControl,
50                                    \ pamconfTypeLineCont skipwhite skipnl
51
52syn keyword pamconfControl          contained requisite required sufficient
53                                    \ optional include substack
54                                    \ nextgroup=pamconfMPath,
55                                    \ pamconfControlLineContH skipwhite
56
57syn match   pamconfControlBegin     '\[' nextgroup=pamconfControlValues,
58                                    \ pamconfControlLineCont skipwhite
59
60syn match   pamconfControlLineCont  contained '\\$'
61                                    \ nextgroup=pamconfControlValues,
62                                    \ pamconfControlLineCont skipwhite skipnl
63
64syn keyword pamconfControlValues    contained success open_err symbol_err
65                                    \ service_err system_err buf_err
66                                    \ perm_denied auth_err cred_insufficient
67                                    \ authinfo_unavail user_unknown maxtries
68                                    \ new_authtok_reqd acct_expired session_err
69                                    \ cred_unavail cred_expired cred_err
70                                    \ no_module_data conv_err authtok_err
71                                    \ authtok_recover_err authtok_lock_busy
72                                    \ authtok_disable_aging try_again ignore
73                                    \ abort authtok_expired module_unknown
74                                    \ bad_item and default
75                                    \ nextgroup=pamconfControlValueEq
76
77syn match   pamconfControlValueEq   contained '='
78                                    \ nextgroup=pamconfControlActionN,
79                                    \           pamconfControlAction
80
81syn match   pamconfControlActionN   contained '\d\+\>'
82                                    \ nextgroup=pamconfControlValues,
83                                    \ pamconfControlLineCont,pamconfControlEnd
84                                    \ skipwhite
85syn keyword pamconfControlAction    contained ignore bad die ok done reset
86                                    \ nextgroup=pamconfControlValues,
87                                    \ pamconfControlLineCont,pamconfControlEnd
88                                    \ skipwhite
89
90syn match   pamconfControlEnd       contained '\]'
91                                    \ nextgroup=pamconfMPath,
92                                    \ pamconfControlLineContH skipwhite
93
94syn match   pamconfControlLineContH contained '\\$'
95                                    \ nextgroup=pamconfMPath,
96                                    \ pamconfControlLineContH skipwhite skipnl
97
98syn match   pamconfMPath            contained '\S\+'
99                                    \ nextgroup=pamconfMPathLineCont,
100                                    \ pamconfArgs skipwhite
101
102syn match   pamconfArgs             contained '\S\+'
103                                    \ nextgroup=pamconfArgsLineCont,
104                                    \ pamconfArgs skipwhite
105
106syn match   pamconfMPathLineCont    contained '\\$'
107                                    \ nextgroup=pamconfMPathLineCont,
108                                    \ pamconfArgs skipwhite skipnl
109
110syn match   pamconfArgsLineCont     contained '\\$'
111                                    \ nextgroup=pamconfArgsLineCont,
112                                    \ pamconfArgs skipwhite skipnl
113
114hi def link pamconfTodo             Todo
115hi def link pamconfComment          Comment
116hi def link pamconfService          Statement
117hi def link pamconfServiceLineCont  Special
118hi def link pamconfType             Special
119hi def link pamconfTypeKeyword      Type
120hi def link pamconfTypeLineCont     pamconfServiceLineCont
121hi def link pamconfControl          Macro
122hi def link pamconfControlBegin     Delimiter
123hi def link pamconfControlLineContH pamconfServiceLineCont
124hi def link pamconfControlLineCont  pamconfServiceLineCont
125hi def link pamconfControlValues    Identifier
126hi def link pamconfControlValueEq   Operator
127hi def link pamconfControlActionN   Number
128hi def link pamconfControlAction    Identifier
129hi def link pamconfControlEnd       Delimiter
130hi def link pamconfMPath            String
131hi def link pamconfMPathLineCont    pamconfServiceLineCont
132hi def link pamconfArgs             Normal
133hi def link pamconfArgsLineCont     pamconfServiceLineCont
134hi def link pamconfInclude          Include
135hi def link pamconfIncludeFile      Include
136
137let b:current_syntax = "pamconf"
138
139let &cpo = s:cpo_save
140unlet s:cpo_save