Add function to get jj diff for current buffer

This commit is contained in:
themodrnhakr 2025-10-02 16:11:02 -05:00
parent ecdb456815
commit 9a58ea573b

View File

@ -24,6 +24,21 @@ local function _define_signs()
vim.fn.sign_define("JjDiffDelete", { text = "", texthl = "JjDiffDelete", numhl = "JjDiffDelete" })
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)
opts = opts or {}
_define_signs() -- Call to define signs