motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit f32bdf1a7ba0bf5c2bea5965d765e3a03af9e00c (tree)
parent 4a77929a3292fafb0f8e52b081fd6c83fcfd3218
Author: Tim Pope <code@tpope.net>
Date:   Sat, 21 Jun 2014 13:44:44 -0400

Only :diffoff our own diffs

Closes #395.

Diffstat:
Mplugin/fugitive.vim | 18++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim @@ -1408,19 +1408,25 @@ call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execut augroup fugitive_diff autocmd! autocmd BufWinLeave * - \ if getwinvar(bufwinnr(+expand('<abuf>')), '&diff') && - \ s:diff_window_count() == 2 && - \ !empty(getbufvar(+expand('<abuf>'), 'git_dir')) | + \ if s:can_diffoff(+expand('<abuf>')) && s:diff_window_count() == 2 | \ call s:diffoff_all(getbufvar(+expand('<abuf>'), 'git_dir')) | \ endif autocmd BufWinEnter * - \ if getwinvar(bufwinnr(+expand('<abuf>')), '&diff') && - \ s:diff_window_count() == 1 && - \ !empty(getbufvar(+expand('<abuf>'), 'git_dir')) | + \ if s:can_diffoff(+expand('<abuf>')) && s:diff_window_count() == 1 | \ call s:diffoff() | \ endif augroup END +function! s:can_diffoff(buf) abort + return getwinvar(bufwinnr(a:buf), '&diff') && + \ !empty(getbufvar(a:buf, 'git_dir')) && + \ !empty(getwinvar(bufwinnr(a:buf), 'fugitive_diff_restore')) +endfunction + +function! fugitive#can_diffoff(buf) abort + return s:can_diffoff(a:buf) +endfunction + function! s:diff_horizontal(count) abort let fdc = matchstr(&diffopt, 'foldcolumn:\zs\d\+') if &diffopt =~# 'horizontal' && &diffopt !~# 'vertical'