diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index ba9ec0ddfa70ee2cc26bfbd9fff42b1fd5d23a6d..70451ebbc31d024fbbc3cec147805e562e7afe2f 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -670,8 +670,17 @@ function! s:Git(bang, args) abort let git .= ' --no-pager' endif let args = matchstr(a:args,'\v\C.{-}%($|\\@<!%(\\\\)*\|)@=') - call s:ExecuteInTree('!'.git.' '.args) - call fugitive#reload_status() + if exists(':terminal') + let dir = s:repo().tree() + tabnew + execute 'lcd' fnameescape(dir) + execute 'terminal' git args + else + call s:ExecuteInTree('!'.git.' '.args) + if has('win32') + call fugitive#reload_status() + endif + endif return matchstr(a:args, '\v\C\\@<!%(\\\\)*\|\zs.*') endfunction @@ -708,6 +717,7 @@ augroup fugitive_status autocmd! if !has('win32') autocmd FocusGained,ShellCmdPost * call fugitive#reload_status() + autocmd BufDelete term://* call fugitive#reload_status() endif augroup END