Add more info about a key
Show ID and creation time when viewing, editing or choosing a recipient (suggested by Curt Sampson)
This commit is contained in:
parent
b932a58be9
commit
16412c1b18
@ -146,6 +146,9 @@ augroup GnuPG
|
|||||||
autocmd VimLeave *.\(gpg\|asc\|pgp\) call s:GPGCleanup()
|
autocmd VimLeave *.\(gpg\|asc\|pgp\) call s:GPGCleanup()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
" Section: Constants {{{1
|
||||||
|
let s:GPGMagicString = "\t \t"
|
||||||
|
|
||||||
" Section: Highlight setup {{{1
|
" Section: Highlight setup {{{1
|
||||||
highlight default link GPGWarning WarningMsg
|
highlight default link GPGWarning WarningMsg
|
||||||
highlight default link GPGError ErrorMsg
|
highlight default link GPGError ErrorMsg
|
||||||
@ -607,10 +610,11 @@ function s:GPGEditRecipients()
|
|||||||
|
|
||||||
" put some comments to the scratch buffer
|
" put some comments to the scratch buffer
|
||||||
silent put ='GPG: ----------------------------------------------------------------------'
|
silent put ='GPG: ----------------------------------------------------------------------'
|
||||||
silent put ='GPG: Please edit the list of recipients, one recipient per line'
|
silent put ='GPG: Please edit the list of recipients, one recipient per line.'
|
||||||
silent put ='GPG: Unknown recipients have a prepended \"!\"'
|
silent put ='GPG: Unknown recipients have a prepended \"!\".'
|
||||||
silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically'
|
silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.'
|
||||||
silent put ='GPG: Closing this buffer commits changes'
|
silent put ='GPG: Data after recipients between and including \"(\" and \")\" is ignored.'
|
||||||
|
silent put ='GPG: Closing this buffer commits changes.'
|
||||||
silent put ='GPG: ----------------------------------------------------------------------'
|
silent put ='GPG: ----------------------------------------------------------------------'
|
||||||
|
|
||||||
" get the recipients
|
" get the recipients
|
||||||
@ -649,6 +653,7 @@ function s:GPGEditRecipients()
|
|||||||
highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient
|
highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient
|
||||||
|
|
||||||
syntax match GPGComment "^GPG:.*$"
|
syntax match GPGComment "^GPG:.*$"
|
||||||
|
exec 'syntax match GPGComment "' . s:GPGMagicString . '.*$"'
|
||||||
highlight clear GPGComment
|
highlight clear GPGComment
|
||||||
highlight link GPGComment Comment
|
highlight link GPGComment Comment
|
||||||
endif
|
endif
|
||||||
@ -688,9 +693,13 @@ function s:GPGFinishRecipientsBuffer()
|
|||||||
let recipients = []
|
let recipients = []
|
||||||
let lines = getline(1,"$")
|
let lines = getline(1,"$")
|
||||||
for recipient in lines
|
for recipient in lines
|
||||||
|
" delete all text after magic string
|
||||||
|
let recipient = substitute(recipient, s:GPGMagicString . ".*$", "", "")
|
||||||
|
|
||||||
" delete all spaces at beginning and end of the recipient
|
" delete all spaces at beginning and end of the recipient
|
||||||
" also delete a '!' at the beginning of the recipient
|
" also delete a '!' at the beginning of the recipient
|
||||||
let recipient = substitute(recipient, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "")
|
let recipient = substitute(recipient, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "")
|
||||||
|
|
||||||
" delete comment lines
|
" delete comment lines
|
||||||
let recipient = substitute(recipient, "^GPG:.*$", "", "")
|
let recipient = substitute(recipient, "^GPG:.*$", "", "")
|
||||||
|
|
||||||
@ -808,11 +817,11 @@ function s:GPGEditOptions()
|
|||||||
silent put ='GPG: ----------------------------------------------------------------------'
|
silent put ='GPG: ----------------------------------------------------------------------'
|
||||||
silent put ='GPG: THERE IS NO CHECK OF THE ENTERED OPTIONS!'
|
silent put ='GPG: THERE IS NO CHECK OF THE ENTERED OPTIONS!'
|
||||||
silent put ='GPG: YOU NEED TO KNOW WHAT YOU ARE DOING!'
|
silent put ='GPG: YOU NEED TO KNOW WHAT YOU ARE DOING!'
|
||||||
silent put ='GPG: IF IN DOUBT, QUICKLY EXIT USING :x OR :bd'
|
silent put ='GPG: IF IN DOUBT, QUICKLY EXIT USING :x OR :bd.'
|
||||||
silent put ='GPG: Please edit the list of options, one option per line'
|
silent put ='GPG: Please edit the list of options, one option per line.'
|
||||||
silent put ='GPG: Please refer to the gpg documentation for valid options'
|
silent put ='GPG: Please refer to the gpg documentation for valid options.'
|
||||||
silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically'
|
silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.'
|
||||||
silent put ='GPG: Closing this buffer commits changes'
|
silent put ='GPG: Closing this buffer commits changes.'
|
||||||
silent put ='GPG: ----------------------------------------------------------------------'
|
silent put ='GPG: ----------------------------------------------------------------------'
|
||||||
|
|
||||||
" put the options in the scratch buffer
|
" put the options in the scratch buffer
|
||||||
@ -939,7 +948,6 @@ function s:GPGNameToID(name)
|
|||||||
|
|
||||||
" parse the output of gpg
|
" parse the output of gpg
|
||||||
let pubseen = 0
|
let pubseen = 0
|
||||||
let uidseen = 0
|
|
||||||
let counter = 0
|
let counter = 0
|
||||||
let gpgids = []
|
let gpgids = []
|
||||||
let choices = "The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n"
|
let choices = "The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n"
|
||||||
@ -948,15 +956,8 @@ function s:GPGNameToID(name)
|
|||||||
" search for the next uid
|
" search for the next uid
|
||||||
if (pubseen == 1)
|
if (pubseen == 1)
|
||||||
if (fields[0] == "uid")
|
if (fields[0] == "uid")
|
||||||
if (uidseen == 0)
|
|
||||||
let choices = choices . counter . ": " . fields[9] . "\n"
|
|
||||||
let counter = counter+1
|
|
||||||
let uidseen = 1
|
|
||||||
else
|
|
||||||
let choices = choices . " " . fields[9] . "\n"
|
let choices = choices . " " . fields[9] . "\n"
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
let uidseen = 0
|
|
||||||
let pubseen = 0
|
let pubseen = 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -964,7 +965,14 @@ function s:GPGNameToID(name)
|
|||||||
" search for the next pub
|
" search for the next pub
|
||||||
if (pubseen == 0)
|
if (pubseen == 0)
|
||||||
if (fields[0] == "pub")
|
if (fields[0] == "pub")
|
||||||
let gpgids += [fields[4]]
|
let identity = fields[4]
|
||||||
|
let gpgids += [identity]
|
||||||
|
if exists("*strftime")
|
||||||
|
let choices = choices . counter . ": ID: 0x" . identity . " created at " . strftime("%c", fields[5]) . "\n"
|
||||||
|
else
|
||||||
|
let choices = choices . counter . ": ID: 0x" . identity . "\n"
|
||||||
|
endif
|
||||||
|
let counter = counter+1
|
||||||
let pubseen = 1
|
let pubseen = 1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -1017,7 +1025,11 @@ function s:GPGIDToName(identity)
|
|||||||
else " search for the next uid
|
else " search for the next uid
|
||||||
if (fields[0] == "uid")
|
if (fields[0] == "uid")
|
||||||
let pubseen = 0
|
let pubseen = 0
|
||||||
let uid = fields[9]
|
if exists("*strftime")
|
||||||
|
let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . " created at " . strftime("%c", fields[5]) . ")"
|
||||||
|
else
|
||||||
|
let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . ")"
|
||||||
|
endif
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user