Add support for specifying an alternate --homedir

Reported-By: Matt Callaway <matt.callaway@gmail.com>
Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
James McCoy 2011-11-23 15:35:01 -05:00
parent 7d102c843a
commit 5394d0c1f1

View File

@ -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