diff options
Diffstat (limited to 'runtime/syntax/pamconf.vim')
-rw-r--r-- | runtime/syntax/pamconf.vim | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/runtime/syntax/pamconf.vim b/runtime/syntax/pamconf.vim index 10d667bdf5..29132848a9 100644 --- a/runtime/syntax/pamconf.vim +++ b/runtime/syntax/pamconf.vim @@ -1,7 +1,8 @@ " Vim syntax file " Language: pam(8) configuration file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-08-03 +" Latest Revision: 2020/08/04 +" Changes By: Haochen Tong if exists("b:current_syntax") @@ -11,23 +12,32 @@ endif let s:cpo_save = &cpo set cpo&vim -syn match pamconfService '^[[:graph:]]\+' - \ nextgroup=pamconfType, - \ pamconfServiceLineCont skipwhite +let s:has_service_field = exists("b:pamconf_has_service_field") + \ ? b:pamconf_has_service_field + \ : expand('%:t') == 'pam.conf' ? 1 : 0 + +syn match pamconfType '-\?[[:alpha:]]\+' + \ contains=pamconfTypeKeyword + \ nextgroup=pamconfControl, + \ pamconfTypeLineCont skipwhite + +syn keyword pamconfTypeKeyword contained account auth password session + +if s:has_service_field + syn match pamconfService '^[[:graph:]]\+' + \ nextgroup=pamconfType, + \ pamconfServiceLineCont skipwhite + + syn match pamconfServiceLineCont contained '\\$' + \ nextgroup=pamconfType, + \ pamconfServiceLineCont skipwhite skipnl +endif syn keyword pamconfTodo contained TODO FIXME XXX NOTE syn region pamconfComment display oneline start='#' end='$' \ contains=pamconfTodo,@Spell -syn match pamconfServiceLineCont contained '\\$' - \ nextgroup=pamconfType, - \ pamconfServiceLineCont skipwhite skipnl - -syn keyword pamconfType account auth password session - \ nextgroup=pamconfControl, - \ pamconfTypeLineCont skipwhite - syn match pamconfTypeLineCont contained '\\$' \ nextgroup=pamconfControl, \ pamconfTypeLineCont skipwhite skipnl @@ -98,7 +108,8 @@ hi def link pamconfTodo Todo hi def link pamconfComment Comment hi def link pamconfService Statement hi def link pamconfServiceLineCont Special -hi def link pamconfType Type +hi def link pamconfType Special +hi def link pamconfTypeKeyword Type hi def link pamconfTypeLineCont pamconfServiceLineCont hi def link pamconfControl Macro hi def link pamconfControlBegin Delimiter |