diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 47eced1..0f7f3f7 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -726,9 +726,11 @@ function s:GPGEncrypt() return endif - call rename(destfile, resolve(expand(''))) + let filename = resolve(expand('')) + call rename(destfile, filename) if auType == 'BufWrite' setl nomodified + let &readonly = filereadable(filename) && filewritable(filename) == 0 endif silent exe ':doautocmd '. auType .'Post '. autocmd_filename