From a3e4dc94d45d703c3f493b62324a54274b7f6b99 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 4 Nov 2015 21:02:31 -0500 Subject: [PATCH] Set 'readonly' per the permissions of the encrypted file. Closes jamessan/vim-gnupg#51 Signed-off-by: James McCoy --- plugin/gnupg.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 874a39f..1a912c3 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -1,5 +1,5 @@ " Name: gnupg.vim -" Last Change: 2015 Sep 29 +" Last Change: 2015 Nov 04 " Maintainer: James McCoy " Original Author: Markus Braun " Summary: Vim plugin for transparent editing of gpg encrypted files. @@ -587,6 +587,7 @@ function s:GPGDecrypt(bufread) 1mark [ $mark ] let &undolevels = levels + let &readonly = filereadable(filename) && filewritable(filename) == 0 " call the autocommand for the file minus .gpg$ silent execute ':doautocmd BufReadPost ' . autocmd_filename call s:GPGDebug(2, 'called BufReadPost autocommand for ' . autocmd_filename)