From 42c2d46aa23023ad7e3551224a23d51076060ea3 Mon Sep 17 00:00:00 2001 From: Alex Efros Date: Sat, 14 Jan 2012 00:37:31 +0200 Subject: [PATCH] added doautocmd BufWritePre --- plugin/gnupg.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 08ba580..e621f25 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -159,6 +159,7 @@ augroup GnuPG autocmd BufReadCmd *.\(gpg\|asc\|pgp\) call s:GPGBufReadPost() " convert all text to encrypted text before writing + autocmd BufWriteCmd *.\(gpg\|asc\|pgp\) call s:GPGBufWritePre() autocmd BufWriteCmd,FileWriteCmd *.\(gpg\|asc\|pgp\) call s:GPGInit() autocmd BufWriteCmd,FileWriteCmd *.\(gpg\|asc\|pgp\) call s:GPGEncrypt() @@ -461,6 +462,14 @@ function s:GPGBufReadPost() call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGBufReadPost()") endfunction +function s:GPGBufWritePre() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGBufWritePre()") + " call the autocommand for the file minus .gpg$ + execute ':doautocmd BufWritePre ' . fnameescape(expand(':r')) + call s:GPGDebug(2, 'called autocommand for ' . fnameescape(expand(':r'))) + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGBufWritePre()") +endfunction + " Function: s:GPGEncrypt() {{{2 " " encrypts the buffer to all previous recipients