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