From 22f68e70cca8c00938c64021603359dde2279144 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Thu, 9 Oct 2014 16:48:03 +0200 Subject: [PATCH] Add g:GPGRecipientsMenu Allow to set initial contents for recipients menu with g:GPGRecipientsMenu. Example usage: let g:GPGRecipientsMenu="" \."GPG: Example User \" \."GPG: Other User \" --- plugin/gnupg.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 9934a0b..1356afe 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -95,6 +95,16 @@ " If set, these recipients are used as defaults when no other recipient is " defined. This variable is a Vim list. Default is unset. " +" g:GPGRecipientsMenu +" If set, these contents are loaded into the recipients dialog. This +" allows to add commented lines with possible recipients to the list, +" which can uncommented to select the actual recipients. Example: +" +" let g:GPGRecipientsMenu="" +" \."GPG: Example User \" +" \."GPG: Other User \" +" +" " g:GPGUsePipes " If set to 1, use pipes instead of temporary files when interacting with " gnupg. When set to 1, this can cause terminal-based gpg agents to not @@ -274,6 +284,11 @@ function s:GPGInit(bufread) let g:GPGDefaultRecipients = [] endif + if (!exists("g:GPGRecipientsMenu")) + let g:GPGRecipientsMenu = "" + endif + + " prefer not to use pipes since it can garble gpg agent display if (!exists("g:GPGUsePipes")) let g:GPGUsePipes = 0 @@ -804,6 +819,11 @@ function s:GPGEditRecipients() let syntaxPattern = '\(' . join(flaggedNames, '\|') . '\)' endif + let lines = split(g:GPGRecipientsMenu, "\n") + for line in lines + silent put =line + endfor + " define highlight if (has("syntax") && exists("g:syntax_on")) highlight clear GPGUnknownRecipient