Add function to get jj diff for current buffer
This commit is contained in:
parent
ecdb456815
commit
9a58ea573b
@ -24,6 +24,21 @@ local function _define_signs()
|
|||||||
vim.fn.sign_define("JjDiffDelete", { text = "─", texthl = "JjDiffDelete", numhl = "JjDiffDelete" })
|
vim.fn.sign_define("JjDiffDelete", { text = "─", texthl = "JjDiffDelete", numhl = "JjDiffDelete" })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Get jj diff output for the current buffer
|
||||||
|
local function _get_jj_diff_for_buffer()
|
||||||
|
local file_path = vim.api.nvim_buf_get_name(0)
|
||||||
|
if file_path == "" then
|
||||||
|
return nil, "Current buffer is not associated with a file."
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Run 'jj diff' for the specific file
|
||||||
|
local diff_output, err = _run_jj_command({ "diff", "--color=never", file_path })
|
||||||
|
if err then
|
||||||
|
return nil, err
|
||||||
|
end
|
||||||
|
return diff_output
|
||||||
|
end
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
_define_signs() -- Call to define signs
|
_define_signs() -- Call to define signs
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user