mirror of
https://github.com/neovim/neovim.git
synced 2026-08-30 19:11:52 +00:00
feat(difftool): replace old "nvim -d" automatically #38057
Problem:
"nvim -d" doesn't leverage nvim.difftool.
Solution:
If nvim.difftool was enabled via :packadd, automatically
handle "nvim -d" on startup.
nvim -c "packadd nvim.difftool" -d dir1/ dir2/
This commit is contained in:
@@ -115,4 +115,35 @@ describe('nvim.difftool', function()
|
||||
local autocmds = fn.nvim_get_autocmds({ group = 'nvim.difftool.events' })
|
||||
assert(#autocmds > 0, 'autocmds should still exist after closing quickfix window')
|
||||
end)
|
||||
|
||||
it('opens difftool automatically when started with nvim -d', function()
|
||||
-- Start Neovim with -d flag for directory diff
|
||||
clear({
|
||||
args = {
|
||||
'--cmd',
|
||||
'packadd nvim.difftool',
|
||||
'-d',
|
||||
testdir_left,
|
||||
testdir_right,
|
||||
},
|
||||
})
|
||||
|
||||
-- Wait for difftool to open
|
||||
n.poke_eventloop()
|
||||
|
||||
-- Verify we have 3 windows (left, right, and quickfix)
|
||||
eq(3, #fn.getwininfo())
|
||||
|
||||
-- Verify quickfix list has the expected entries
|
||||
local qflist = fn.getqflist()
|
||||
local entries = {}
|
||||
for _, item in ipairs(qflist) do
|
||||
table.insert(entries, { text = item.text, rel = item.user_data and item.user_data.rel })
|
||||
end
|
||||
eq({
|
||||
{ text = 'M', rel = 'file1.txt' },
|
||||
{ text = 'D', rel = 'file2.txt' },
|
||||
{ text = 'A', rel = 'file3.txt' },
|
||||
}, entries)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user