From 24c5a454311a54889818362a054015946dcf5d00 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 14 Apr 2010 11:05:53 -0400 Subject: [PATCH] Disable diff more more aggressively --- plugin/fugitive.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index ae4de11..f61d04b 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -999,10 +999,18 @@ endfunction call s:command("-bang -bar -nargs=? -complete=customlist,s:EditComplete Gdiff :execute s:Diff(0,)") augroup fugitive_diff - autocmd BufWinLeave * if winnr('$') == 2 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | diffoff! | endif - autocmd BufWinEnter * if winnr('$') == 1 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | diffoff | endif + autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | diffoff! | endif + autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | diffoff | endif augroup END +function! s:diff_window_count() + let c = 0 + for nr in range(1,winnr('$')) + let c += getwinvar(nr,'&diff') + endfor + return c +endfunction + function! s:buffer_compare_age(commit) dict abort let scores = {':0': 1, ':1': 2, ':2': 3, ':': 4, ':3': 5} let my_score = get(scores,':'.self.commit(),0)