From 22f68e70cca8c00938c64021603359dde2279144 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Thu, 9 Oct 2014 16:48:03 +0200 Subject: [PATCH 1/2] 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 From d316155866176ba7ac686143d80a4cad4dbf5adc Mon Sep 17 00:00:00 2001 From: Sebastian Neumann Date: Wed, 29 Oct 2014 16:53:59 +0100 Subject: [PATCH 2/2] Refactor g:GPGRecipientsMenu to use list and rename to g:GPGPossibleRecipients let g:GPGPossibleRecipients=[ \"Example User ", \"Other User " \] --- plugin/gnupg.vim | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 1356afe..fa4b2a0 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -95,14 +95,15 @@ " 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 +" g:GPGPossibleRecipients " 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: +" which can be uncommented to select the actual recipients. Example: " -" let g:GPGRecipientsMenu="" -" \."GPG: Example User \" -" \."GPG: Other User \" +" let g:GPGPossibleRecipients=[ +" \"Example User ", +" \"Other User " +" \] " " " g:GPGUsePipes @@ -284,8 +285,8 @@ function s:GPGInit(bufread) let g:GPGDefaultRecipients = [] endif - if (!exists("g:GPGRecipientsMenu")) - let g:GPGRecipientsMenu = "" + if (!exists("g:GPGPossibleRecipients")) + let g:GPGPossibleRecipients = [] endif @@ -819,9 +820,8 @@ function s:GPGEditRecipients() let syntaxPattern = '\(' . join(flaggedNames, '\|') . '\)' endif - let lines = split(g:GPGRecipientsMenu, "\n") - for line in lines - silent put =line + for line in g:GPGPossibleRecipients + silent put ='GPG: '.line endfor " define highlight