From 6be6f96aa5a7b4c866862950e763f9a4598d4db0 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 23 Jan 2018 22:06:27 -0500 Subject: [PATCH] Do not set buftype=acwrite for FileReadCmd FileReadCmd reads the contents of another file into the current buffer. Therefore, it should honor the settings ('buftype' and :file) of the current buffer. Closes jamessan/vim-gnupg#86 Signed-off-by: James McCoy --- plugin/gnupg.vim | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 205a0e2..ce5c9af 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -1,5 +1,5 @@ " Name: gnupg.vim -" Last Change: 2017 Dec 15 +" Last Change: 2018 Jan 23 " Maintainer: James McCoy " Original Author: Markus Braun " Summary: Vim plugin for transparent editing of gpg encrypted files. @@ -607,12 +607,14 @@ function s:GPGDecrypt(bufread) call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()") return endif - " Ensure the buffer is only saved by using our BufWriteCmd - set buftype=acwrite - " Always set the buffer name to the absolute path, otherwise Vim won't - " track the correct buffer name when changing directories (due to - " buftype=acwrite). - exe 'file' fnameescape(filename) + if a:bufread + " Ensure the buffer is only saved by using our BufWriteCmd + set buftype=acwrite + " Always set the buffer name to the absolute path, otherwise Vim won't + " track the correct buffer name when changing directories (due to + " buftype=acwrite). + exe 'file' fnameescape(filename) + endif else execute silent 'read' fnameescape(filename) endif