From 6c44c4795e0cfcd8439a7d558d013f246b60d077 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 25 May 2010 16:48:34 -0400 Subject: [PATCH] Only :diffoff in 'diff' buffers --- plugin/fugitive.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 5de9c88..3bcab0a 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -1000,8 +1000,8 @@ call s:command("-bang -bar -nargs=? -complete=customlist,s:EditComplete Gdiff :e augroup fugitive_diff autocmd! - 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 + autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | windo call s:diff_off() | endif + autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | call s:diff_off() | endif augroup END function! s:diff_window_count() @@ -1012,6 +1012,12 @@ function! s:diff_window_count() return c endfunction +function! s:diff_off() + if &l:diff + diffoff + endif +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)