From 30a49872ca56fd973bfdb6e100b91483091b9a85 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 5 Jan 2015 22:36:31 -0500 Subject: [PATCH] Emit BufReadPre/FileReadPre when decrypting the file Signed-off-by: James McCoy --- plugin/gnupg.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index f6498eb..469b467 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -1,5 +1,5 @@ " Name: gnupg.vim -" Last Change: 2014 Dec 25 +" Last Change: 2015 Jan 01 " Maintainer: James McCoy " Original Author: Markus Braun " Summary: Vim plugin for transparent editing of gpg encrypted files. @@ -510,6 +510,14 @@ function s:GPGDecrypt(bufread) return endif + if a:bufread + silent execute ':doautocmd BufReadPre ' . fnameescape(expand(':r')) + call s:GPGDebug(2, 'called BufReadPre autocommand for ' . fnameescape(expand(':r'))) + else + silent execute ':doautocmd FileReadPre ' . fnameescape(expand(':r')) + call s:GPGDebug(2, 'called FileReadPre autocommand for ' . fnameescape(expand(':r'))) + endif + " check if the message is armored if (match(output, "gpg: armor header") >= 0) call s:GPGDebug(1, "this file is armored")