diffedit inline
This commit is contained in:
parent
23abd72cf8
commit
7000c3a405
6 changed files with 43 additions and 45 deletions
|
|
@ -1,17 +1,21 @@
|
|||
local M = {}
|
||||
|
||||
M.is_jj_diffedit_open = function()
|
||||
local qf = vim.fn.getqflist()
|
||||
|
||||
local entry = qf[1]
|
||||
local entry = vim.fn.getqflist[1]
|
||||
if not entry or not entry.user_data or not entry.user_data.diff then
|
||||
for _, buf in ipairs(vim.api.nvim_list_bufs()) do -- close all /tmp buffers
|
||||
if vim.fn.fnamemodify(vim.api.nvim_buf_get_name(buf), ':p'):match('/tmp/jj%-diff.*') then
|
||||
vim.api.nvim_buf_delete(buf, { force = true })
|
||||
end
|
||||
end
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
M.diffedit = function()
|
||||
vim.fn.jobstart('jj diffedit --tool diffview-new')
|
||||
M.diffedit = function(opts)
|
||||
vim.fn.jobstart('jj diffedit --tool diffview-new ' .. opts.args)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command('Diffedit', M.diffedit, { nargs = '*' })
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue