commit affce710e296f384585e7dbe3b2be4d9d04be49f (tree)
parent a5e9b2e93ed07423c2619d6719d9c1a91b2c0679
Author: Tim Pope <code@tpope.net>
Date: Sat, 13 Nov 2010 20:26:53 -0500
Mitigate conflict with DirDiff plugin
This plugin tries to be helpful about disabling diff mode when a diff
window closes, which was confusing DirDiff. We can mitigate that but
only disabling diff mode when b:git_dir matches.
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -1013,7 +1013,7 @@ call s:command("-bar -nargs=? -complete=customlist,s:EditComplete Gsdiff :execut
augroup fugitive_diff
autocmd!
- autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | call s:diff_off_all() | endif
+ autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | call s:diff_off_all(getbufvar(+expand('<abuf>'), 'git_dir')) | endif
autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | diffoff | endif
augroup END
@@ -1025,14 +1025,16 @@ function! s:diff_window_count()
return c
endfunction
-function! s:diff_off_all()
+function! s:diff_off_all(dir)
for nr in range(1,winnr('$'))
if getwinvar(nr,'&diff')
if nr != winnr()
execute nr.'wincmd w'
let restorewinnr = 1
endif
- diffoff
+ if exists('b:git_dir') && b:git_dir ==# a:dir
+ diffoff
+ endif
if exists('restorewinnr')
wincmd p
endif