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 <jamessan@jamessan.com>
This commit is contained in:
James McCoy 2018-01-23 22:06:27 -05:00
parent b54fd4c18a
commit 6be6f96aa5
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB

View File

@ -1,5 +1,5 @@
" Name: gnupg.vim " Name: gnupg.vim
" Last Change: 2017 Dec 15 " Last Change: 2018 Jan 23
" Maintainer: James McCoy <jamessan@jamessan.com> " Maintainer: James McCoy <jamessan@jamessan.com>
" Original Author: Markus Braun <markus.braun@krawel.de> " Original Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files. " 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()") call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
return return
endif endif
" Ensure the buffer is only saved by using our BufWriteCmd if a:bufread
set buftype=acwrite " Ensure the buffer is only saved by using our BufWriteCmd
" Always set the buffer name to the absolute path, otherwise Vim won't set buftype=acwrite
" track the correct buffer name when changing directories (due to " Always set the buffer name to the absolute path, otherwise Vim won't
" buftype=acwrite). " track the correct buffer name when changing directories (due to
exe 'file' fnameescape(filename) " buftype=acwrite).
exe 'file' fnameescape(filename)
endif
else else
execute silent 'read' fnameescape(filename) execute silent 'read' fnameescape(filename)
endif endif