From ae1b31965ee222580cfe2f46b638318b771a530f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 22 Oct 2017 23:16:28 -0400 Subject: [PATCH] Ensure buftype=acwrite is always set for the buffer The user may be a) editing an existing encrypted file, b) creating a new encrypted file, c) editing an unnamed buffer and saving it as an encrypted file. In all cases, 'buftype' should be set correctly once we know the buffer is intended to be encrypted. Signed-off-by: James McCoy --- plugin/gnupg.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 4be9130..eb36375 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -1,5 +1,5 @@ " Name: gnupg.vim -" Last Change: 2017 May 31 +" Last Change: 2017 Oct 22 " Maintainer: James McCoy " Original Author: Markus Braun " Summary: Vim plugin for transparent editing of gpg encrypted files. @@ -478,6 +478,8 @@ function s:GPGDecrypt(bufread) silent execute ':doautocmd BufNewFile ' . fnameescape(autocmd_filename) call s:GPGDebug(2, 'called BufNewFile autocommand for ' . autocmd_filename) + set buftype=acwrite + " 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) @@ -752,6 +754,7 @@ function s:GPGEncrypt() if auType == 'BufWrite' setl nomodified + setl buftype=acwrite let &readonly = filereadable(filename) && filewritable(filename) == 0 endif