## Problem Conflict resolution virtual text only showed plain "current" / "incoming" labels with no keymap hints. Users had no way to discover available resolution keymaps without reading docs. ## Solution Default virtual text labels now include keymap hints: `(current — doo)` and `(incoming — dot)`. A new `format_virtual_text` config option lets users customize or hide labels entirely. A new `show_actions` option (off by default) renders a codelens-style action line above each `<<<<<<<` marker listing all enabled resolution keymaps. Merge diff views also gain hunk hints on `@@` header lines showing available keymaps. New config fields: `conflict.format_virtual_text` (function|nil), `conflict.show_actions` (boolean). New highlight group: `DiffsConflictActions`.
74 lines
2.8 KiB
Markdown
74 lines
2.8 KiB
Markdown
# diffs.nvim
|
|
|
|
**Syntax highlighting for diffs in Neovim**
|
|
|
|
Enhance `vim-fugitive` and Neovim's built-in diff mode with language-aware
|
|
syntax highlighting.
|
|
|
|

|
|
|
|
## Features
|
|
|
|
- Treesitter syntax highlighting in fugitive diffs and commit views
|
|
- Character-level intra-line diff highlighting
|
|
- `:Gdiff` unified diff against any revision
|
|
- Background-only diff colors for `&diff` buffers
|
|
- Inline merge conflict detection, highlighting, and resolution
|
|
- Vim syntax fallback, context padding, configurable blend/debounce
|
|
|
|
## Requirements
|
|
|
|
- Neovim 0.9.0+
|
|
|
|
## Installation
|
|
|
|
Install with your package manager of choice or via
|
|
[luarocks](https://luarocks.org/modules/barrettruth/diffs.nvim):
|
|
|
|
```
|
|
luarocks install diffs.nvim
|
|
```
|
|
|
|
## Documentation
|
|
|
|
```vim
|
|
:help diffs.nvim
|
|
```
|
|
|
|
## Known Limitations
|
|
|
|
- **Incomplete syntax context**: Treesitter parses each diff hunk in isolation.
|
|
To improve accuracy, `diffs.nvim` reads lines from disk before and after each
|
|
hunk for parsing context (`highlights.context`, enabled by default with 25
|
|
lines). This resolves most boundary issues. Set
|
|
`highlights.context.enabled = false` to disable.
|
|
|
|
- **Syntax flashing**: `diffs.nvim` hooks into the `FileType fugitive` event
|
|
triggered by `vim-fugitive`, at which point the buffer is preliminarily
|
|
painted. The buffer is then re-painted after `debounce_ms` milliseconds,
|
|
causing an unavoidable visual "flash" even when `debounce_ms = 0`.
|
|
|
|
- **Conflicting diff plugins**: `diffs.nvim` may not interact well with other
|
|
plugins that modify diff highlighting. Known plugins that may conflict:
|
|
- [`diffview.nvim`](https://github.com/sindrets/diffview.nvim) - provides its
|
|
own diff highlighting and conflict resolution UI
|
|
- [`mini.diff`](https://github.com/echasnovski/mini.diff) - visualizes buffer
|
|
differences with its own highlighting system
|
|
- [`gitsigns.nvim`](https://github.com/lewis6991/gitsigns.nvim) - generally
|
|
compatible, but both plugins modifying line highlights may produce
|
|
unexpected results
|
|
- [`git-conflict.nvim`](https://github.com/akinsho/git-conflict.nvim) -
|
|
`diffs.nvim` now includes built-in conflict resolution; disable one or the
|
|
other to avoid overlap
|
|
|
|
# Acknowledgements
|
|
|
|
- [`vim-fugitive`](https://github.com/tpope/vim-fugitive)
|
|
- [`codediff.nvim`](https://github.com/esmuellert/codediff.nvim)
|
|
- [`diffview.nvim`](https://github.com/sindrets/diffview.nvim)
|
|
- [`difftastic`](https://github.com/Wilfred/difftastic)
|
|
- [`mini.diff`](https://github.com/echasnovski/mini.diff)
|
|
- [`gitsigns.nvim`](https://github.com/lewis6991/gitsigns.nvim)
|
|
- [`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
|