mirror of
https://github.com/lewis6991/gitsigns.nvim
synced 2025-02-23 00:07:04 +00:00
feat(diffthis): 3 way diff for buffers with conflicts
If the current buffer is marked with conflicts AND the buffer's base is unset, then diffthis will open a 3 way diff.
This commit is contained in:
parent
8b817e76b6
commit
9c3ca02766
18
lua/gitsigns/diffthis.lua
generated
18
lua/gitsigns/diffthis.lua
generated
@ -135,7 +135,23 @@ M.diffthis = void(function(base, opts)
|
||||
if vim.wo.diff then
|
||||
return
|
||||
end
|
||||
run(base, true, opts)
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local bcache = cache[bufnr]
|
||||
if not bcache then
|
||||
return
|
||||
end
|
||||
|
||||
if not base and bcache.git_obj.has_conflicts then
|
||||
local cwin = api.nvim_get_current_win()
|
||||
run(':2', true, opts)
|
||||
api.nvim_set_current_win(cwin)
|
||||
opts.split = 'belowright'
|
||||
run(':3', true, opts)
|
||||
api.nvim_set_current_win(cwin)
|
||||
else
|
||||
run(base, true, opts)
|
||||
end
|
||||
end)
|
||||
|
||||
M.show = void(function(base)
|
||||
|
@ -135,7 +135,23 @@ M.diffthis = void(function(base: string, opts: M.DiffthisOpts)
|
||||
if vim.wo.diff then
|
||||
return
|
||||
end
|
||||
run(base, true, opts)
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local bcache = cache[bufnr]
|
||||
if not bcache then
|
||||
return
|
||||
end
|
||||
|
||||
if not base and bcache.git_obj.has_conflicts then
|
||||
local cwin = api.nvim_get_current_win()
|
||||
run(':2', true, opts)
|
||||
api.nvim_set_current_win(cwin)
|
||||
opts.split = 'belowright'
|
||||
run(':3', true, opts)
|
||||
api.nvim_set_current_win(cwin)
|
||||
else
|
||||
run(base, true, opts)
|
||||
end
|
||||
end)
|
||||
|
||||
M.show = void(function(base: string)
|
||||
|
Loading…
Reference in New Issue
Block a user