diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 92fcf3f..c9c7895 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -4162,7 +4162,9 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args try let mods = s:Mods(a:mods, 'Edge') let file = fugitive#Find(':', dir) - let arg = ' +setl\ foldmarker=<<<<<<<<,>>>>>>>>\|let\ w:fugitive_status=FugitiveGitDir() ' . + let arg = ' +setl\ foldmarker=<<<<<<<<,>>>>>>>>' . + \ (exists('&winfixbuf') ? '\ winfixbuf' : '') . + \ '\|let\ w:fugitive_status=FugitiveGitDir() ' . \ s:fnameescape(file) for tabnr in [tabpagenr()] + (mods =~# '\' ? range(1, tabpagenr('$')) : []) let bufs = tabpagebuflist(tabnr) @@ -4176,6 +4178,9 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args exe winnr . 'wincmd w' endif let w:fugitive_status = dir + if exists('&winfixbuf') + setlocal winfixbuf + endif 1 return '' endif @@ -6203,7 +6208,7 @@ function! fugitive#DiffClose() abort endfunction function! s:BlurStatus() abort - if (&previewwindow || exists('w:fugitive_status')) && get(b:,'fugitive_type', '') ==# 'index' + if (&previewwindow || getwinvar(winnr(), '&winfixbuf') is# 1 || exists('w:fugitive_status')) && get(b:, 'fugitive_type', '') ==# 'index' let winnrs = filter([winnr('#')] + range(1, winnr('$')), 's:UsableWin(v:val)') if len(winnrs) exe winnrs[0].'wincmd w'