Emit BufReadPre/FileReadPre when decrypting the file

Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
James McCoy 2015-01-05 22:36:31 -05:00
parent 3c01375c3b
commit 30a49872ca

View File

@ -1,5 +1,5 @@
" Name: gnupg.vim " Name: gnupg.vim
" Last Change: 2014 Dec 25 " Last Change: 2015 Jan 01
" Maintainer: James McCoy <vega.james@gmail.com> " Maintainer: James McCoy <vega.james@gmail.com>
" Original Author: Markus Braun <markus.braun@krawel.de> " Original Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files. " Summary: Vim plugin for transparent editing of gpg encrypted files.
@ -510,6 +510,14 @@ function s:GPGDecrypt(bufread)
return return
endif endif
if a:bufread
silent execute ':doautocmd BufReadPre ' . fnameescape(expand('<afile>:r'))
call s:GPGDebug(2, 'called BufReadPre autocommand for ' . fnameescape(expand('<afile>:r')))
else
silent execute ':doautocmd FileReadPre ' . fnameescape(expand('<afile>:r'))
call s:GPGDebug(2, 'called FileReadPre autocommand for ' . fnameescape(expand('<afile>:r')))
endif
" check if the message is armored " check if the message is armored
if (match(output, "gpg: armor header") >= 0) if (match(output, "gpg: armor header") >= 0)
call s:GPGDebug(1, "this file is armored") call s:GPGDebug(1, "this file is armored")