Set b:git_dir for :terminal buffers

This commit is contained in:
Tim Pope
2019-09-04 15:22:22 -04:00
parent 40bc5aff18
commit 10c54dfc93

View File

@@ -2114,12 +2114,13 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
\ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') ||
\ index(['--paginate', '-p'], args[0]) >= 0
let mods = substitute(s:Mods(a:mods), '\<tab\>', '-tab', 'g')
let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : ''
if has('nvim')
if &autowrite || &autowriteall | silent! wall | endif
return mods . (a:line2 ? 'split' : 'edit') . ' term://' . s:fnameescape(s:UserCommand(dir, args)) . '|startinsert' . after
return mods . (a:line2 ? 'split' : 'edit') . ' term://' . s:fnameescape(s:UserCommand(dir, args)) . assign . '|startinsert' . after
elseif has('terminal')
if &autowrite || &autowriteall | silent! wall | endif
return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(dir) + args, 's:fnameescape(v:val)'))) . after
return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(dir) + args, 's:fnameescape(v:val)'))) . assign . after
endif
endif
if has('gui_running') && !has('win32')