added doautocmd BufWritePre

This commit is contained in:
Alex Efros 2012-01-14 00:37:31 +02:00
parent 648fa8821d
commit 42c2d46aa2

View File

@ -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('<afile>:r'))
call s:GPGDebug(2, 'called autocommand for ' . fnameescape(expand('<afile>:r')))
call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGBufWritePre()")
endfunction
" Function: s:GPGEncrypt() {{{2
"
" encrypts the buffer to all previous recipients