From 2039676d9762b511e497c66af622f3cf0a1926d6 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 17 Aug 2021 16:57:11 -0400 Subject: [PATCH] Respect environment variable overrides when opening terminal --- autoload/fugitive.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 508554e..5b37d59 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3295,12 +3295,17 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort \ type(pager) == type('')) && pager isnot# 1 let mods = substitute(s:Mods(a:mods), '\', '-tab', 'g') let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : '' + let argv = s:UserCommandList(options) + args + let term_opts = len(env) ? {'env': env} : {} if has('nvim') call fugitive#Autowrite() - return mods . (a:line2 ? 'new' : 'enew') . '|call termopen(' . string(s:UserCommandList(options) + args) . ')' . assign . '|startinsert' . after - elseif has('terminal') + return mods . (a:line2 ? 'new' : 'enew') . '|call termopen(' . string(argv) . ', ' . string(term_opts) . ')' . assign . '|startinsert' . after + elseif exists('*term_start') call fugitive#Autowrite() - return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(options) + args, 's:fnameescape(v:val)'))) . assign . after + if !a:line2 + let term_opts.curwin = 1 + endif + return mods . 'call term_start(' . string(argv) . ', ' . string(term_opts) . ')' . assign . after endif endif if pager is# 1 && editcmd ==# 'read'