added doautocmd BufWritePre

This commit is contained in:
Alex Efros 2012-01-14 00:37:31 +02:00 committed by James McCoy
parent ebc86fca44
commit f04de4883c

View File

@ -159,6 +159,7 @@ augroup GnuPG
autocmd BufReadCmd *.\(gpg\|asc\|pgp\) call s:GPGBufReadPost() autocmd BufReadCmd *.\(gpg\|asc\|pgp\) call s:GPGBufReadPost()
" convert all text to encrypted text before writing " 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:GPGInit()
autocmd BufWriteCmd,FileWriteCmd *.\(gpg\|asc\|pgp\) call s:GPGEncrypt() autocmd BufWriteCmd,FileWriteCmd *.\(gpg\|asc\|pgp\) call s:GPGEncrypt()
@ -461,6 +462,14 @@ function s:GPGBufReadPost()
call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGBufReadPost()") call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGBufReadPost()")
endfunction 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 " Function: s:GPGEncrypt() {{{2
" "
" encrypts the buffer to all previous recipients " encrypts the buffer to all previous recipients