mirror of
https://github.com/Ascyii/vim-gnupg.git
synced 2026-01-01 06:14:24 -05:00
Only define "unknown recipient" syntax if there are unknown recipients
Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
" Name: gnupg.vim
|
" Name: gnupg.vim
|
||||||
" Last Change: 2012 Oct 28
|
" Last Change: 2013 Jan 24
|
||||||
" Maintainer: James McCoy <vega.james@gmail.com>
|
" Maintainer: James McCoy <vega.james@gmail.com>
|
||||||
" Original Author: Markus Braun <markus.braun@krawel.de>
|
" Original Author: Markus Braun <markus.braun@krawel.de>
|
||||||
" Summary: Vim plugin for transparent editing of gpg encrypted files.
|
" Summary: Vim plugin for transparent editing of gpg encrypted files.
|
||||||
@@ -754,19 +754,20 @@ function s:GPGEditRecipients()
|
|||||||
endfor
|
endfor
|
||||||
|
|
||||||
" put the unknown recipients in the scratch buffer
|
" put the unknown recipients in the scratch buffer
|
||||||
let syntaxPattern = "\\(nonexxistinwordinthisbuffer"
|
let syntaxPattern = ''
|
||||||
for name in unknownrecipients
|
if !empty(unknownrecipients)
|
||||||
let name = "!" . name
|
let flaggedNames = map(unknownrecipients, '"!".v:val')
|
||||||
let syntaxPattern = syntaxPattern . "\\|" . fnameescape(name)
|
call append('$', flaggedNames)
|
||||||
silent put =name
|
let syntaxPattern = '\(' . join(flaggedNames, '\|') . '\)'
|
||||||
endfor
|
endif
|
||||||
let syntaxPattern = syntaxPattern . "\\)"
|
|
||||||
|
|
||||||
" define highlight
|
" define highlight
|
||||||
if (has("syntax") && exists("g:syntax_on"))
|
if (has("syntax") && exists("g:syntax_on"))
|
||||||
execute 'syntax match GPGUnknownRecipient "' . syntaxPattern . '"'
|
|
||||||
highlight clear GPGUnknownRecipient
|
highlight clear GPGUnknownRecipient
|
||||||
|
if !empty(syntaxPattern)
|
||||||
|
execute 'syntax match GPGUnknownRecipient "' . syntaxPattern . '"'
|
||||||
highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient
|
highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient
|
||||||
|
endif
|
||||||
|
|
||||||
syntax match GPGComment "^GPG:.*$"
|
syntax match GPGComment "^GPG:.*$"
|
||||||
execute 'syntax match GPGComment "' . s:GPGMagicString . '.*$"'
|
execute 'syntax match GPGComment "' . s:GPGMagicString . '.*$"'
|
||||||
|
|||||||
Reference in New Issue
Block a user