Fix :Ghdiffsplit with diffopt=vertical

Closes https://github.com/tpope/vim-fugitive/issues/990
This commit is contained in:
Tim Pope 2019-08-15 19:34:06 -04:00
parent cf9ef7377f
commit c972b2a065

View File

@ -4414,6 +4414,11 @@ function! s:Diff(autodir, keepfocus, mods, ...) abort
call map(parents, 's:Relative(v:val . ":")')
endif
endif
try
if &diffopt =~# 'vertical'
let diffopt = &diffopt
set diffopt-=vertical
endif
if exists('parents') && len(parents) > 1
let mods = (a:autodir ? s:diff_modifier(len(parents) + 1) : '') . s:Mods(mods, 'leftabove')
let nr = bufnr('')
@ -4464,7 +4469,6 @@ function! s:Diff(autodir, keepfocus, mods, ...) abort
else
let file = s:Relative(':0:')
endif
try
let spec = s:Generate(file)
let restore = s:diff_restore()
if exists('+cursorbind')
@ -4491,6 +4495,10 @@ function! s:Diff(autodir, keepfocus, mods, ...) abort
return post
catch /^fugitive:/
return 'echoerr ' . string(v:exception)
finally
if exists('diffopt')
let &diffopt = diffopt
endif
endtry
endfunction