From c64ca827f3e6c829cb076d592bfe91fa3c7efb27 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 6 Mar 2026 08:35:08 -0500 Subject: [PATCH] feat(init): add `gitsigns` config field and `get_highlight_opts()` getter Problem: gitsigns blame popup highlighting needs access to diffs.nvim's highlight config, but no public API exposes it. Solution: add `diffs.GitsignsConfig` type, `gitsigns` field (default `false`) with normalization and validation, and a public `get_highlight_opts()` getter returning `hide_prefix` + `highlights`. --- lua/diffs/init.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lua/diffs/init.lua b/lua/diffs/init.lua index 7e5dd04..06b6ad9 100644 --- a/lua/diffs/init.lua +++ b/lua/diffs/init.lua @@ -38,6 +38,8 @@ ---@class diffs.NeogitConfig +---@class diffs.GitsignsConfig + ---@class diffs.ConflictKeymaps ---@field ours string|false ---@field theirs string|false @@ -62,6 +64,7 @@ ---@field highlights diffs.Highlights ---@field fugitive diffs.FugitiveConfig|false ---@field neogit diffs.NeogitConfig|false +---@field gitsigns diffs.GitsignsConfig|false ---@field conflict diffs.ConflictConfig ---@class diffs @@ -141,6 +144,7 @@ local default_config = { }, fugitive = false, neogit = false, + gitsigns = false, conflict = { enabled = true, disable_diagnostics = true, @@ -591,6 +595,10 @@ local function init() opts.neogit = {} end + if opts.gitsigns == true then + opts.gitsigns = {} + end + vim.validate('debug', opts.debug, function(v) return v == nil or type(v) == 'boolean' or type(v) == 'string' end, 'boolean or string (file path)') @@ -601,6 +609,9 @@ local function init() vim.validate('neogit', opts.neogit, function(v) return v == nil or v == false or type(v) == 'table' end, 'table or false') + vim.validate('gitsigns', opts.gitsigns, function(v) + return v == nil or v == false or type(v) == 'table' + end, 'table or false') vim.validate('extra_filetypes', opts.extra_filetypes, 'table', true) vim.validate('highlights', opts.highlights, 'table', true) @@ -990,6 +1001,12 @@ function M.get_conflict_config() return config.conflict end +---@return diffs.HunkOpts +function M.get_highlight_opts() + init() + return { hide_prefix = config.hide_prefix, highlights = config.highlights } +end + local function process_pending_clear(bufnr) local entry = hunk_cache[bufnr] if entry and entry.pending_clear then