Set "buftype=acwrite" for encrypted buffers

This ensures any write of the buffer requires a configured BufWriteCmd
autocmd, providing more safe guards against problems like
jamessan/vim-gnupg#77.

Signed-off-by: James McCoy <jamessan@jamessan.com>
This commit is contained in:
James McCoy 2017-02-14 22:08:42 -05:00
parent 7d0a149169
commit 5103285d4d
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB

View File

@ -583,6 +583,8 @@ 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
set buftype=acwrite
else else
execute silent 'read' fnameescape(filename) execute silent 'read' fnameescape(filename)
endif endif