Conversation
This was referenced Feb 25, 2026
Open
barrettruth
added a commit
to barrettruth/diffs.nvim
that referenced
this pull request
Feb 25, 2026
## Problem diffs.nvim was blanking 18 Neogit highlight groups globally on attach to prevent Neogit's `line_hl_group` fg from stomping treesitter syntax. It also fell back to `getcwd()` plus a subprocess call for repo root detection on Neogit buffers, and had no mechanism to refresh the hunk cache when Neogit lazy-loaded new diff sections. ## Solution Adopts three APIs introduced in NeogitOrg/neogit#1897: - Sets `vim.b.neogit_disable_hunk_highlight = true` on the Neogit buffer at attach time. Neogit's `HunkLine` renderer skips all its own highlight logic when this is set, replacing the need to blank 18 hl groups globally and the associated ColorScheme re-application. - Reads `vim.b.neogit_git_dir` in `get_repo_root()` as a reliable fallback between the existing `b:git_dir` check and the `getcwd()` subprocess path. - Registers a buffer-local `User NeogitDiffLoaded` autocmd on attach that calls `M.refresh()` when Neogit lazy-loads a new diff section, keeping the hunk cache in sync. Closes #128
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UsereventNeogitDiffLoaded