mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-09 03:53:47 -05:00
@@ -1408,19 +1408,25 @@ call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execut
|
|||||||
augroup fugitive_diff
|
augroup fugitive_diff
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWinLeave *
|
autocmd BufWinLeave *
|
||||||
\ if getwinvar(bufwinnr(+expand('<abuf>')), '&diff') &&
|
\ if s:can_diffoff(+expand('<abuf>')) && s:diff_window_count() == 2 |
|
||||||
\ s:diff_window_count() == 2 &&
|
|
||||||
\ !empty(getbufvar(+expand('<abuf>'), 'git_dir')) |
|
|
||||||
\ call s:diffoff_all(getbufvar(+expand('<abuf>'), 'git_dir')) |
|
\ call s:diffoff_all(getbufvar(+expand('<abuf>'), 'git_dir')) |
|
||||||
\ endif
|
\ endif
|
||||||
autocmd BufWinEnter *
|
autocmd BufWinEnter *
|
||||||
\ if getwinvar(bufwinnr(+expand('<abuf>')), '&diff') &&
|
\ if s:can_diffoff(+expand('<abuf>')) && s:diff_window_count() == 1 |
|
||||||
\ s:diff_window_count() == 1 &&
|
|
||||||
\ !empty(getbufvar(+expand('<abuf>'), 'git_dir')) |
|
|
||||||
\ call s:diffoff() |
|
\ call s:diffoff() |
|
||||||
\ endif
|
\ endif
|
||||||
augroup END
|
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
|
function! s:diff_horizontal(count) abort
|
||||||
let fdc = matchstr(&diffopt, 'foldcolumn:\zs\d\+')
|
let fdc = matchstr(&diffopt, 'foldcolumn:\zs\d\+')
|
||||||
if &diffopt =~# 'horizontal' && &diffopt !~# 'vertical'
|
if &diffopt =~# 'horizontal' && &diffopt !~# 'vertical'
|
||||||
|
|||||||
Reference in New Issue
Block a user