Closed anhari closed 2 years ago
Hi @anhari, thanks for the fix here! Unfortunately, it seems to break things for older versions of fugitive. I tested on tpope/vim-fugitive@ddc5e1a21a9981fd55933dacbb72857de2090bfe and Vim segfaulted (which is impressive, frankly 😄) when I tried to run GitNextConflict
. I'm not sure what all is at play there, but ideally, we could have a version of Conflicted that works on any fugitive. Thoughts?
As far as I have been able to find, fugitive does not expose its version in any way.
One simple-but-hacky fix would be to try
/catch
the fugitive error. The messages seem to be consistent.
Something like
function! s:TabEdit(parent)
try
Gtabedit :1
catch /fugitive: Use ':[1-3]:%' instead of ':[1-3]'/
Gtabedit :1:%
endtry
let b:conflicted_version = 'base'
diffthis
try
execute 'Gvsplit :' . s:VersionNumber(a:parent)
catch /fugitive: Use ':[1-3]:%' instead of ':[1-3]'/
execute 'Gvsplit :' . s:VersionNumber(a:parent) . '.%'
endtry
let b:conflicted_version = a:parent
diffthis
wincmd r
With the new fugitive, I get a message "Please use Gdiffsplit! for 3-way split" with master & this branch.
Fugitive.vim updated the
s:Expand
function a few days ago, and I ran into some errors this morning when using vim-conflicted:I think this should fix things, but might need a closer look since my vimscript is a bit rough :)