blob: 1b5f901348fe6cad01b815f790d1db67964f8975 [file] [log] [blame]
Bram Moolenaar42eeac32005-06-29 22:40:58 +00001" Vim syntax file
Bram Moolenaar214641f2017-03-05 17:04:09 +01002" Language: pam(8) configuration file
3" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
Christian Brabandt807fff12024-03-31 18:04:21 +02004" Latest Change: 2024/03/31
Bram Moolenaare7b1ea02020-08-07 19:54:59 +02005" Changes By: Haochen Tong
Christian Brabandt807fff12024-03-31 18:04:21 +02006" Vim Project for the @include syntax
Bram Moolenaar42eeac32005-06-29 22:40:58 +00007
8if exists("b:current_syntax")
9 finish
10endif
11
12let s:cpo_save = &cpo
13set cpo&vim
14
Bram Moolenaare7b1ea02020-08-07 19:54:59 +020015let 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
Christian Brabandt807fff12024-03-31 18:04:21 +020026" The @include syntax is Debian specific
27syn match pamconfInclude '^@include'
28 \ nextgroup=pamconfIncludeFile
29 \ skipwhite
30
31syn match pamconfIncludeFile '\f\+$'
32
Bram Moolenaare7b1ea02020-08-07 19:54:59 +020033if 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
Bram Moolenaar42eeac32005-06-29 22:40:58 +000042
43syn keyword pamconfTodo contained TODO FIXME XXX NOTE
44
45syn region pamconfComment display oneline start='#' end='$'
46 \ contains=pamconfTodo,@Spell
47
Bram Moolenaar42eeac32005-06-29 22:40:58 +000048syn match pamconfTypeLineCont contained '\\$'
49 \ nextgroup=pamconfControl,
50 \ pamconfTypeLineCont skipwhite skipnl
51
52syn keyword pamconfControl contained requisite required sufficient
Bram Moolenaar5302d9e2011-09-14 17:55:08 +020053 \ optional include substack
Bram Moolenaar42eeac32005-06-29 22:40:58 +000054 \ 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
Bram Moolenaar5302d9e2011-09-14 17:55:08 +020077syn match pamconfControlValueEq contained '='
78 \ nextgroup=pamconfControlActionN,
79 \ pamconfControlAction
Bram Moolenaar42eeac32005-06-29 22:40:58 +000080
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
Bram Moolenaare7b1ea02020-08-07 19:54:59 +0200118hi def link pamconfType Special
119hi def link pamconfTypeKeyword Type
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000120hi 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
Christian Brabandt807fff12024-03-31 18:04:21 +0200134hi def link pamconfInclude Include
135hi def link pamconfIncludeFile Include
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000136
137let b:current_syntax = "pamconf"
138
139let &cpo = s:cpo_save
140unlet s:cpo_save