diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index d537ad1..83dfb0f 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1822,7 +1822,7 @@ function! s:Git(bang, mods, args) abort let args = matchstr(a:args,'\v\C.{-}%($|\\@0, , '')") call s:command("-bar -bang -range=-1 G :execute s:Status(0, , '')") -augroup fugitive_status - autocmd! - if !has('win32') - autocmd ShellCmdPost * call fugitive#ReloadStatus() - autocmd QuickFixCmdPost c*ile call fugitive#ReloadStatus() - autocmd FocusGained * call fugitive#ReloadStatus() - autocmd BufDelete term://* call fugitive#ReloadStatus() - endif -augroup END function! s:Status(bang, count, mods) abort try @@ -2043,6 +2034,24 @@ function! fugitive#ReloadStatus(...) abort endtry endfunction +function! s:CanAutoReloadStatus() abort + return get(g:, 'fugitive_autoreload_status', !has('win32')) +endfunction + +function! s:AutoReloadStatus(...) abort + if s:CanAutoReloadStatus() + return call('fugitive#ReloadStatus', a:000) + endif +endfunction + +augroup fugitive_status + autocmd! + autocmd ShellCmdPost * call s:AutoReloadStatus() + autocmd QuickFixCmdPost c*file call s:AutoReloadStatus() + autocmd FocusGained * call s:AutoReloadStatus() + autocmd BufDelete term://* call s:AutoReloadStatus() +augroup END + function! s:StageInfo(...) abort let lnum = a:0 ? a:1 : line('.') let sigil = matchstr(getline(lnum), '^[ @\+-]')