feat: gitsigns blame popup highlighting (#157)

## Problem

gitsigns' `:Gitsigns blame_line` popup shows flat
`GitSignsAddPreview`/`GitSignsDeletePreview` line highlights with basic
word-level inline diffs, but no treesitter syntax or diffs.nvim's
character-level intra-line highlighting.

## Solution

Add `lua/diffs/gitsigns.lua` which patches gitsigns' `Popup.create` and
`Popup.update` to intercept blame popups. Parses `Hunk N of M` sections
from the popup buffer, clears gitsigns' own `gitsigns_popup` namespace
on the diff region, and applies `highlight_hunk` with manual
`@diff.plus`/`@diff.minus` prefix extmarks. Uses a separate
`diffs-gitsigns` namespace to avoid colliding with the main decoration
provider.

Enabled via `vim.g.diffs = { gitsigns = true }`. Wired in
`plugin/diffs.lua` with a `User GitAttach` lazy-load retry for when
gitsigns loads after diffs.nvim. Config plumbing adds
`get_highlight_opts()` as a public getter, replacing the
`debug.getupvalue` hack used by the standalone `blame_hl.nvim` plugin.

Closes #155.
This commit is contained in:
Barrett Ruth 2026-03-06 08:42:02 -05:00 committed by GitHub
parent c498fd2bac
commit 993fed4a45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 492 additions and 10 deletions

View file

@ -16,6 +16,7 @@ with language-aware syntax highlighting.
word-level accuracy)
- `:Gdiff` unified diff against any revision
- Inline merge conflict detection, highlighting, and resolution
- gitsigns.nvim blame popup highlighting
- Email quoting/patch syntax support (`> diff ...`)
- Vim syntax fallback
- Configurable highlighiting blend & priorities
@ -58,14 +59,15 @@ luarocks install diffs.nvim
Do not lazy load `diffs.nvim` with `event`, `lazy`, `ft`, `config`, or `keys` to
control loading - `diffs.nvim` lazy-loads itself.
**Q: Does diffs.nvim support vim-fugitive/Neogit?**
**Q: Does diffs.nvim support vim-fugitive/Neogit/gitsigns?**
Yes. Enable it in your config:
Yes. Enable integrations in your config:
```lua
vim.g.diffs = {
fugitive = true,
neogit = true,
gitsigns = true,
}
```
@ -119,4 +121,5 @@ See the documentation for more information.
- [`git-conflict.nvim`](https://github.com/akinsho/git-conflict.nvim)
- [@phanen](https://github.com/phanen) - diff header highlighting, unknown
filetype fix, shebang/modeline detection, treesitter injection support,
decoration provider highlighting architecture
decoration provider highlighting architecture, gitsigns blame popup
highlighting