Add configuration options to M.setup

This commit is contained in:
themodrnhakr 2025-10-02 16:13:44 -05:00
parent 497e3bf94a
commit 6e72a16f7b

View File

@ -2,6 +2,16 @@
local M = {} local M = {}
-- Default configuration
local config = {
signs = {
add = { text = "", texthl = "JjDiffAdd", numhl = "JjDiffAdd" },
change = { text = "", texthl = "JjDiffChange", numhl = "JjDiffChange" },
delete = { text = "", texthl = "JjDiffDelete", numhl = "JjDiffDelete" },
},
autocmd_events = { "BufReadPost", "BufWritePost", "CursorHold" },
}
-- Helper function to run jj commands -- Helper function to run jj commands
local function _run_jj_command(args) local function _run_jj_command(args)
local cmd = "jj " .. table.concat(args, " ") local cmd = "jj " .. table.concat(args, " ")
@ -19,9 +29,9 @@ end
-- Define Neovim signs for diff -- Define Neovim signs for diff
local function _define_signs() local function _define_signs()
vim.fn.sign_define("JjDiffAdd", { text = "", texthl = "JjDiffAdd", numhl = "JjDiffAdd" }) vim.fn.sign_define("JjDiffAdd", config.signs.add)
vim.fn.sign_define("JjDiffChange", { text = "", texthl = "JjDiffChange", numhl = "JjDiffChange" }) vim.fn.sign_define("JjDiffChange", config.signs.change)
vim.fn.sign_define("JjDiffDelete", { text = "", texthl = "JjDiffDelete", numhl = "JjDiffDelete" }) vim.fn.sign_define("JjDiffDelete", config.signs.delete)
end end
-- Get jj diff output for the current buffer -- Get jj diff output for the current buffer