From 7d0a149169517d80a4bee5aded4b009928104171 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 14 Feb 2017 21:57:51 -0500 Subject: [PATCH] Remove GPGCleanup function If 'autowrite' is set, an encrypted buffer is modified, and ":q!"/"ZQ" is executed, GPGCleanup's "only!" would cause the buffer to be abandoned. Due to 'autowrite' and the VimLeave autocmd not using "nested", abandoning the buffer causes Vim to write the buffer, which is currently unencrypted, overwriting the encrypted file with plain text. Since the user can more reliably clear their own console/terminal scroll back than we can, simply remove this functionality. It's safer than trying to unwind the twisty passages of Vim's autocmds, especially those of the *WriteCmd variety. Closes jamessan/vim-gnupg#77 Signed-off-by: James McCoy --- plugin/gnupg.vim | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index c007cc8..ddc310a 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -1,5 +1,5 @@ " Name: gnupg.vim -" Last Change: 2016 Dec 18 +" Last Change: 2017 Feb 14 " Maintainer: James McCoy " Original Author: Markus Braun " Summary: Vim plugin for transparent editing of gpg encrypted files. @@ -205,9 +205,6 @@ augroup GnuPG \ " call s:GPGInit(0) |" . \ " call s:GPGEncrypt() |" . \ " endif" - - " cleanup on leaving vim - exe "autocmd VimLeave " . g:GPGFilePattern . " call s:GPGCleanup()" augroup END " Section: Constants {{{1 @@ -430,19 +427,6 @@ function s:GPGInit(bufread) let s:GPGInitRun = 1 endfunction -" Function: s:GPGCleanup() {{{2 -" -" cleanup on leaving vim -" -function s:GPGCleanup() - call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCleanup()") - - " wipe out screen - new +only! - redraw! - - call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCleanup()") -endfunction " Function: s:GPGDecrypt(bufread) {{{2 "