Skip to content

Commit 32b0d62

Browse files
committed
Hunt other tabs for window on :tab Git
I'm not 100% sure if this is the correct (as in least surprising) behavior, but it seems like as good of place as any to start. Closes #1740
1 parent 8f4a23e commit 32b0d62

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

autoload/fugitive.vim

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,18 +3103,22 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args
31033103
let file = fugitive#Find(':', dir)
31043104
let arg = ' +let\ w:fugitive_status=FugitiveGitDir() ' .
31053105
\ s:fnameescape(file)
3106-
for winnr in range(1, winnr('$'))
3107-
if s:cpath(file, fnamemodify(bufname(winbufnr(winnr)), ':p'))
3108-
if winnr == winnr()
3109-
call s:ReloadStatus()
3110-
else
3111-
call s:ExpireStatus(dir)
3112-
exe winnr . 'wincmd w'
3106+
for tabnr in [tabpagenr()] + (mods =~# '\<tab\>' ? range(1, tabpagenr('$')) : [])
3107+
let bufs = tabpagebuflist(tabnr)
3108+
for winnr in range(1, tabpagewinnr(tabnr, '$'))
3109+
if s:cpath(file, fnamemodify(bufname(bufs[winnr-1]), ':p'))
3110+
if tabnr == tabpagenr() && winnr == winnr()
3111+
call s:ReloadStatus()
3112+
else
3113+
call s:ExpireStatus(dir)
3114+
exe tabnr . 'tabnext'
3115+
exe winnr . 'wincmd w'
3116+
endif
3117+
let w:fugitive_status = dir
3118+
1
3119+
return ''
31133120
endif
3114-
let w:fugitive_status = dir
3115-
1
3116-
return ''
3117-
endif
3121+
endfor
31183122
endfor
31193123
if a:count ==# 0
31203124
return mods . 'edit' . (a:bang ? '!' : '') . arg

0 commit comments

Comments
 (0)