From 7fcea1a08423da3012aac87f5224738c85d212a1 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 22 Jun 2018 22:32:53 -0400 Subject: [PATCH] Simplify list handling in GPGView{Options,Recipients} Signed-off-by: James McCoy --- plugin/gnupg.vim | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index f6b0eb3..da5768e 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -803,24 +803,17 @@ function s:GPGViewRecipients() let recipients = s:GPGCheckRecipients(b:GPGRecipients) echo 'This file has following recipients (Unknown recipients have a prepended "!"):' - " echo the recipients - for name in recipients.valid - let name = s:GPGIDToName(name) - echo name - endfor - - " echo the unknown recipients - echohl GPGWarning - for name in recipients.unknown - let name = "!" . name - echo name - endfor - echohl None - - " check if there is any known recipient if empty(recipients.valid) echohl GPGError - echom 'There are no known recipients!' + echo 'There are no known recipients!' + echohl None + else + echo join(map(recipients.valid, 's:GPGIDToName(v:val)'), "\n") + endif + + if !empty(recipients.unknown) + echohl GPGWarning + echo join(map(recipients.unknown, '"!".v:val'), "\n") echohl None endif @@ -1033,10 +1026,7 @@ function s:GPGViewOptions() if (exists("b:GPGOptions")) echo 'This file has following options:' - " echo the options - for option in b:GPGOptions - echo option - endfor + echo join(b:GPGOptions, "\n") endif call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewOptions()")