From 7f8b6ce1ebff771d7e1f4b9d5b16513d6c12f9f8 Mon Sep 17 00:00:00 2001 From: Jonas Hahn Date: Mon, 3 Nov 2025 11:14:54 +0100 Subject: [PATCH] Skip enter when the defaults are set --- autoload/gnupg.vim | 10 +++++++--- plugin/gnupg.vim | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/autoload/gnupg.vim b/autoload/gnupg.vim index f0e6588..cd90492 100644 --- a/autoload/gnupg.vim +++ b/autoload/gnupg.vim @@ -293,7 +293,7 @@ function gnupg#decrypt(bufread) " This is a new file, so force the user to edit the recipient list if " they open a new file and public keys are preferred if (g:GPGPreferSymmetric == 0) - call gnupg#edit_recipients() + call gnupg#edit_recipients(0) endif return @@ -669,11 +669,11 @@ function gnupg#view_recipients() call s:GPGDebug(3, "<<<<<<<< Leaving gnupg#view_recipients()") endfunction -" Function: gnupg#edit_recipients() {{{2 +" Function: gnupg#edit_recipients(to_open) {{{2 " " create a scratch buffer with all recipients to add/remove recipients " -function gnupg#edit_recipients() +function gnupg#edit_recipients(to_open) call s:GPGDebug(3, ">>>>>>>> Entering gnupg#edit_recipients()") if s:unencrypted() @@ -753,6 +753,10 @@ function gnupg#edit_recipients() endif call s:GPGDebug(3, "<<<<<<<< Leaving gnupg#edit_recipients()") + + if (exists('g:GPGDefaultRecipients') && a:to_open == 0) + execute ':q' + endif endfunction " Function: s:GPGFinishRecipientsBuffer() {{{2 diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 5051371..7263ec5 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -55,7 +55,7 @@ highlight default link GPGHighlightUnknownRecipient ErrorMsg " Section: Commands {{{1 command! GPGViewRecipients call gnupg#view_recipients() -command! GPGEditRecipients call gnupg#edit_recipients() +command! GPGEditRecipients call gnupg#edit_recipients(1) command! GPGViewOptions call gnupg#view_options() command! GPGEditOptions call gnupg#edit_options()