mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 06:43:51 -05:00
Smart choice of vertical or horizontal diff
This commit is contained in:
@@ -1386,7 +1386,7 @@ endfunction
|
||||
" }}}1
|
||||
" Gdiff {{{1
|
||||
|
||||
call s:command("-bang -bar -nargs=* -complete=customlist,s:EditComplete Gdiff :execute s:Diff(<bang>0,<f-args>)")
|
||||
call s:command("-bang -bar -nargs=* -complete=customlist,s:EditComplete Gdiff :execute s:Diff(s:diff_horizontal(),<f-args>)")
|
||||
call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gvdiff :execute s:Diff(0,<f-args>)")
|
||||
call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execute s:Diff(1,<f-args>)")
|
||||
|
||||
@@ -1406,6 +1406,16 @@ augroup fugitive_diff
|
||||
\ endif
|
||||
augroup END
|
||||
|
||||
function! s:diff_horizontal() abort
|
||||
if &diffopt =~# 'horizontal' && &diffopt !~# 'vertical'
|
||||
return 1
|
||||
elseif &diffopt =~# 'vertical'
|
||||
return 0
|
||||
else
|
||||
return winwidth(0) <= 2 * (&tw ? &tw : 80)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:diff_window_count() abort
|
||||
let c = 0
|
||||
for nr in range(1,winnr('$'))
|
||||
|
||||
Reference in New Issue
Block a user