From 70d5bee79767f4dd5d0c7259b4e219c6cb9f3368 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Thu, 5 Mar 2026 09:27:48 -0500 Subject: [PATCH] fix(init): remove NeogitDiffContextHighlight override workaround (#147) ## Problem diffs.nvim blanked `NeogitDiffContextHighlight` globally on attach and on `ColorScheme` to work around Neogit's `ViewContext` decoration provider overriding `DiffsAdd`/`DiffsDelete` line backgrounds with `NeogitDiffContextHighlight` at priority 200. ## Solution Remove the `override_neogit_context_highlights` workaround. NeogitOrg/neogit#1907 moves the `neogit_disable_hunk_highlight` check inside ViewContext's per-line loop, so non-cursor lines skip `add_line_highlight` entirely. `vim.b[bufnr].neogit_disable_hunk_highlight = true` (set on attach) is sufficient. Closes #135 --- lua/diffs/init.lua | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lua/diffs/init.lua b/lua/diffs/init.lua index 242c247..d1cc7d2 100644 --- a/lua/diffs/init.lua +++ b/lua/diffs/init.lua @@ -489,14 +489,6 @@ local function compute_highlight_groups() end end -local neogit_context_hl_overridden = false - --- TODO: remove once NeogitOrg/neogit#1904 merges and is released (tracked in #135) -local function override_neogit_context_highlights() - vim.api.nvim_set_hl(0, 'NeogitDiffContextHighlight', {}) - neogit_context_hl_overridden = true -end - local function init() if initialized then return @@ -720,9 +712,6 @@ local function init() vim.api.nvim_create_autocmd('ColorScheme', { callback = function() compute_highlight_groups() - if neogit_context_hl_overridden then - override_neogit_context_highlights() - end for bufnr, _ in pairs(attached_buffers) do invalidate_cache(bufnr) end @@ -848,7 +837,6 @@ function M.attach(bufnr) local neogit_augroup = nil if config.neogit and vim.bo[bufnr].filetype:match('^Neogit') then vim.b[bufnr].neogit_disable_hunk_highlight = true - override_neogit_context_highlights() neogit_augroup = vim.api.nvim_create_augroup('diffs_neogit_' .. bufnr, { clear = true }) vim.api.nvim_create_autocmd('User', { pattern = 'NeogitDiffLoaded',