From 8e0c41bf6b5903e61b40900506f95e23359328e9 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 7 Feb 2026 15:45:34 -0500 Subject: [PATCH] fix(highlight): add default flag to DiffsDiff* groups Problem: DiffsDiff* highlight groups lacked default = true, making them impossible for colorschemes to override, inconsistent with the fugitive unified diff groups which already had it. Solution: add default = true to all four DiffsDiffAdd, DiffsDiffDelete, DiffsDiffChange, and DiffsDiffText nvim_set_hl calls. --- doc/diffs.nvim.txt | 6 +++--- lua/diffs/init.lua | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/diffs.nvim.txt b/doc/diffs.nvim.txt index 3db6db6..7704b5b 100644 --- a/doc/diffs.nvim.txt +++ b/doc/diffs.nvim.txt @@ -398,9 +398,9 @@ diff-related features. ============================================================================== HIGHLIGHT GROUPS *diffs-highlights* -diffs.nvim defines custom highlight groups. Fugitive unified diff groups use -`default = true`, so colorschemes can override them. Diff mode groups are -always derived from the corresponding `Diff*` groups. +diffs.nvim defines custom highlight groups. All groups use `default = true`, +so colorschemes can override them by defining the group before the plugin +loads. All derived groups are computed by alpha-blending a source color into the `Normal` background. Line-level groups blend at 40% alpha for a subtle tint; diff --git a/lua/diffs/init.lua b/lua/diffs/init.lua index cfdfb4b..14a4c13 100644 --- a/lua/diffs/init.lua +++ b/lua/diffs/init.lua @@ -219,10 +219,14 @@ local function compute_highlight_groups() local diff_change = resolve_hl('DiffChange') local diff_text = resolve_hl('DiffText') - vim.api.nvim_set_hl(0, 'DiffsDiffAdd', { bg = diff_add.bg }) - vim.api.nvim_set_hl(0, 'DiffsDiffDelete', { fg = diff_delete.fg, bg = diff_delete.bg }) - vim.api.nvim_set_hl(0, 'DiffsDiffChange', { bg = diff_change.bg }) - vim.api.nvim_set_hl(0, 'DiffsDiffText', { bg = diff_text.bg }) + vim.api.nvim_set_hl(0, 'DiffsDiffAdd', { default = true, bg = diff_add.bg }) + vim.api.nvim_set_hl( + 0, + 'DiffsDiffDelete', + { default = true, fg = diff_delete.fg, bg = diff_delete.bg } + ) + vim.api.nvim_set_hl(0, 'DiffsDiffChange', { default = true, bg = diff_change.bg }) + vim.api.nvim_set_hl(0, 'DiffsDiffText', { default = true, bg = diff_text.bg }) end local function init()