blob: 29132848a95d5305770015dea6de0c146655af37 [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>
Bram Moolenaare7b1ea02020-08-07 19:54:59 +02004" Latest Revision: 2020/08/04
5" Changes By: Haochen Tong
Bram Moolenaar42eeac32005-06-29 22:40:58 +00006
7
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
26if s:has_service_field
27 syn match pamconfService '^[[:graph:]]\+'
28 \ nextgroup=pamconfType,
29 \ pamconfServiceLineCont skipwhite
30
31 syn match pamconfServiceLineCont contained '\\$'
32 \ nextgroup=pamconfType,
33 \ pamconfServiceLineCont skipwhite skipnl
34endif
Bram Moolenaar42eeac32005-06-29 22:40:58 +000035
36syn keyword pamconfTodo contained TODO FIXME XXX NOTE
37
38syn region pamconfComment display oneline start='#' end='$'
39 \ contains=pamconfTodo,@Spell
40
Bram Moolenaar42eeac32005-06-29 22:40:58 +000041syn match pamconfTypeLineCont contained '\\$'
42 \ nextgroup=pamconfControl,
43 \ pamconfTypeLineCont skipwhite skipnl
44
45syn keyword pamconfControl contained requisite required sufficient
Bram Moolenaar5302d9e2011-09-14 17:55:08 +020046 \ optional include substack
Bram Moolenaar42eeac32005-06-29 22:40:58 +000047 \ nextgroup=pamconfMPath,
48 \ pamconfControlLineContH skipwhite
49
50syn match pamconfControlBegin '\[' nextgroup=pamconfControlValues,
51 \ pamconfControlLineCont skipwhite
52
53syn match pamconfControlLineCont contained '\\$'
54 \ nextgroup=pamconfControlValues,
55 \ pamconfControlLineCont skipwhite skipnl
56
57syn keyword pamconfControlValues contained success open_err symbol_err
58 \ service_err system_err buf_err
59 \ perm_denied auth_err cred_insufficient
60 \ authinfo_unavail user_unknown maxtries
61 \ new_authtok_reqd acct_expired session_err
62 \ cred_unavail cred_expired cred_err
63 \ no_module_data conv_err authtok_err
64 \ authtok_recover_err authtok_lock_busy
65 \ authtok_disable_aging try_again ignore
66 \ abort authtok_expired module_unknown
67 \ bad_item and default
68 \ nextgroup=pamconfControlValueEq
69
Bram Moolenaar5302d9e2011-09-14 17:55:08 +020070syn match pamconfControlValueEq contained '='
71 \ nextgroup=pamconfControlActionN,
72 \ pamconfControlAction
Bram Moolenaar42eeac32005-06-29 22:40:58 +000073
74syn match pamconfControlActionN contained '\d\+\>'
75 \ nextgroup=pamconfControlValues,
76 \ pamconfControlLineCont,pamconfControlEnd
77 \ skipwhite
78syn keyword pamconfControlAction contained ignore bad die ok done reset
79 \ nextgroup=pamconfControlValues,
80 \ pamconfControlLineCont,pamconfControlEnd
81 \ skipwhite
82
83syn match pamconfControlEnd contained '\]'
84 \ nextgroup=pamconfMPath,
85 \ pamconfControlLineContH skipwhite
86
87syn match pamconfControlLineContH contained '\\$'
88 \ nextgroup=pamconfMPath,
89 \ pamconfControlLineContH skipwhite skipnl
90
91syn match pamconfMPath contained '\S\+'
92 \ nextgroup=pamconfMPathLineCont,
93 \ pamconfArgs skipwhite
94
95syn match pamconfArgs contained '\S\+'
96 \ nextgroup=pamconfArgsLineCont,
97 \ pamconfArgs skipwhite
98
99syn match pamconfMPathLineCont contained '\\$'
100 \ nextgroup=pamconfMPathLineCont,
101 \ pamconfArgs skipwhite skipnl
102
103syn match pamconfArgsLineCont contained '\\$'
104 \ nextgroup=pamconfArgsLineCont,
105 \ pamconfArgs skipwhite skipnl
106
107hi def link pamconfTodo Todo
108hi def link pamconfComment Comment
109hi def link pamconfService Statement
110hi def link pamconfServiceLineCont Special
Bram Moolenaare7b1ea02020-08-07 19:54:59 +0200111hi def link pamconfType Special
112hi def link pamconfTypeKeyword Type
Bram Moolenaar42eeac32005-06-29 22:40:58 +0000113hi def link pamconfTypeLineCont pamconfServiceLineCont
114hi def link pamconfControl Macro
115hi def link pamconfControlBegin Delimiter
116hi def link pamconfControlLineContH pamconfServiceLineCont
117hi def link pamconfControlLineCont pamconfServiceLineCont
118hi def link pamconfControlValues Identifier
119hi def link pamconfControlValueEq Operator
120hi def link pamconfControlActionN Number
121hi def link pamconfControlAction Identifier
122hi def link pamconfControlEnd Delimiter
123hi def link pamconfMPath String
124hi def link pamconfMPathLineCont pamconfServiceLineCont
125hi def link pamconfArgs Normal
126hi def link pamconfArgsLineCont pamconfServiceLineCont
127
128let b:current_syntax = "pamconf"
129
130let &cpo = s:cpo_save
131unlet s:cpo_save