From 60b7fb1ede66296a85aef325a3afd7ea0df7ca10 Mon Sep 17 00:00:00 2001 From: Markus Braun Date: Thu, 14 Dec 2006 10:51:22 +0000 Subject: [PATCH] Aotocommand rework Make GPGFinish*() more robust, change to window if closed from another. Also install autocmd in GPGEdit*() if we split an existing buffer. --- plugin/gnupg.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index ed39531..f5f0ef4 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -392,6 +392,9 @@ fun s:GPGEditRecipients() else " split scratch buffer window exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'") + + " add a autocommand to regenerate the recipients after a write + autocmd BufHidden,BufUnload call s:GPGFinishRecipientsBuffer() endi " empty the buffer @@ -478,12 +481,19 @@ fun s:GPGFinishRecipientsBuffer() return endi + " go to buffer before doing work + if (bufnr("%") != expand("")) + " switch to scratch buffer window + exe 'silent! ' . bufwinnr(expand("")) . "wincmd w" + endi + " clear GPGRecipients and GPGUnknownRecipients let GPGRecipients="" let GPGUnknownRecipients="" " delete the autocommand autocmd! * + let currentline=1 let recipient=getline(currentline) @@ -588,6 +598,9 @@ fun s:GPGEditOptions() else " split scratch buffer window exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'") + + " add a autocommand to regenerate the options after a write + autocmd BufHidden,BufUnload call s:GPGFinishOptionsBuffer() endi " empty the buffer @@ -654,12 +667,19 @@ fun s:GPGFinishOptionsBuffer() return endi + " go to buffer before doing work + if (bufnr("%") != expand("")) + " switch to scratch buffer window + exe 'silent! ' . bufwinnr(expand("")) . "wincmd w" + endi + " clear GPGOptions and GPGUnknownOptions let GPGOptions="" let GPGUnknownOptions="" " delete the autocommand autocmd! * + let currentline=1 let option=getline(currentline)