From 5394d0c1f12313b578c37ed1bb478ed587037d1e Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 23 Nov 2011 15:35:01 -0500 Subject: [PATCH] Add support for specifying an alternate --homedir Reported-By: Matt Callaway Signed-off-by: James McCoy --- plugin/gnupg.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 5cdc18d..e2e7665 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -134,7 +134,7 @@ if (exists("g:loaded_gnupg") || &cp || exists("#BufReadCmd*.\(gpg\|asc\|pgp\)")) finish endif -let g:loaded_gnupg = '2.2' +let g:loaded_gnupg = '2.3' let s:GPGInitRun = 0 " check for correct vim version {{{2 @@ -237,6 +237,11 @@ function s:GPGInit() let g:GPGUsePipes = 0 endif + " allow alternate gnupg homedir + if (!exists('g:GPGHomedir')) + let g:GPGHomedir = '' + endif + " print version call s:GPGDebug(1, "gnupg.vim ". g:loaded_gnupg) @@ -1146,6 +1151,9 @@ endfunction " function s:GPGSystem(dict) let commandline = printf('%s %s', s:GPGCommand, a:dict.args) + if (!empty(g:GPGHomedir)) + let commandline .= ' --homedir ' . shellescape(g:GPGHomedir) + endif let commandline .= ' ' . s:stderrredirnull call s:GPGDebug(a:dict.level, "command: ". commandline) @@ -1168,6 +1176,9 @@ endfunction " function s:GPGExecute(dict) let commandline = printf('%s%s %s', a:dict.ex, s:GPGCommand, a:dict.args) + if (!empty(g:GPGHomedir)) + let commandline .= ' --homedir ' . shellescape(g:GPGHomedir, 1) + endif if (has_key(a:dict, 'redirect')) let commandline .= ' ' . a:dict.redirect endif