From 32c88feb43bcabd3059089bbbac10d9194983325 Mon Sep 17 00:00:00 2001 From: James Vega Date: Sun, 26 Jun 2011 15:40:34 -0400 Subject: [PATCH] Disable 'undofile' for the buffer, if the option exists Signed-off-by: James Vega --- plugin/gnupg.vim | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 9c04125..e68e964 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -1,5 +1,5 @@ " Name: gnupg.vim -" Last Change: 2011 May 24 +" Last Change: 2011 June 26 " Author: James Vega " Original Author: Markus Braun " Summary: Vim plugin for transparent editing of gpg encrypted files. @@ -129,7 +129,7 @@ if (exists("g:loaded_gnupg") || &cp || exists("#BufReadCmd*.\(gpg\|asc\|pgp\)")) finish endif -let g:loaded_gnupg = "$Revision$" +let g:loaded_gnupg = '2.0' let s:GPGInitRun = 0 " check for correct vim version {{{2 @@ -173,18 +173,25 @@ highlight default link GPGHighlightUnknownRecipient ErrorMsg " initialize the plugin " function s:GPGInit() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGInit()") + + " we don't want a swap file, as it writes unencrypted data to disk + setl noswapfile + + " if persistent undo is present, disable it for this buffer + if exists('+undofile') + setl noundofile + endif + + " the rest only has to be run once if s:GPGInitRun return endif - call s:GPGDebug(3, ">>>>>>>> Entering s:GPGInit()") " first make sure nothing is written to ~/.viminfo while editing " an encrypted file. set viminfo= - " we don't want a swap file, as it writes unencrypted data to disk - setl noswapfile - " check what gpg command to use if (!exists("g:GPGExecutable")) let g:GPGExecutable = "gpg --trust-model always" @@ -327,7 +334,7 @@ function s:GPGDecrypt() " get the filename of the current buffer let filename = expand(":p") - " File doesn't exist yet, so force recipients + " File doesn't exist yet, so nothing to decrypt if empty(glob(filename)) return endif