From affce710e296f384585e7dbe3b2be4d9d04be49f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 13 Nov 2010 20:26:53 -0500 Subject: [PATCH] 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. --- plugin/fugitive.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 9603874..163c7b2 100644 --- 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(''), 'git_dir') !=# '' | call s:diff_off_all() | endif + autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | call s:diff_off_all(getbufvar(+expand(''), 'git_dir')) | endif autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand(''), '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