Only :diffoff in 'diff' buffers

This commit is contained in:
Tim Pope
2010-05-25 16:48:34 -04:00
parent 27e2212ac0
commit 6c44c4795e

View File

@@ -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('<abuf>'), 'git_dir') !=# '' | diffoff! | endif
autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | diffoff | endif
autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | windo call s:diff_off() | endif
autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand('<abuf>'), '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)