## Problem The README doesn't mention the optional vscode-diff FFI backend for word-level intra-line accuracy, and the codediff.nvim acknowledgement doesn't credit the author by name. ## Solution Expand the intra-line feature bullet to mention vscode-diff with a link to codediff.nvim. Credit @esmuellert by name in the acknowledgements section. Also update the stale context padding reference in known limitations to match the current behavior.
3 KiB
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 (with optional vscode-diff FFI backend for word-level accuracy)
:Gdiffunified diff against any revision- Background-only diff colors for
&diffbuffers - Inline merge conflict detection, highlighting, and resolution
- Vim syntax fallback, configurable blend/debounce/priorities
Requirements
- Neovim 0.9.0+
Installation
Install with your package manager of choice or via luarocks:
luarocks install diffs.nvim
Documentation
:help diffs.nvim
Known Limitations
-
Incomplete syntax context: Treesitter parses each diff hunk in isolation. Context lines within the hunk (
prefix) provide syntactic context for the parser. In rare cases, hunks that start or end mid-expression may produce imperfect highlights due to treesitter error recovery. -
Syntax flashing:
diffs.nvimhooks into theFileType fugitiveevent triggered byvim-fugitive, at which point the buffer is preliminarily painted. The buffer is then re-painted afterdebounce_msmilliseconds, causing an unavoidable visual "flash" even whendebounce_ms = 0. -
Conflicting diff plugins:
diffs.nvimmay not interact well with other plugins that modify diff highlighting. Known plugins that may conflict:diffview.nvim- provides its own diff highlighting and conflict resolution UImini.diff- visualizes buffer differences with its own highlighting systemgitsigns.nvim- generally compatible, but both plugins modifying line highlights may produce unexpected resultsgit-conflict.nvim-diffs.nvimnow includes built-in conflict resolution; disable one or the other to avoid overlap
Acknowledgements
vim-fugitive- @esmuellert /
codediff.nvim- vscode-diff algorithm FFI backend for word-level intra-line accuracy diffview.nvimdifftasticmini.diffgitsigns.nvimgit-conflict.nvim- @phanen - diff header highlighting, unknown filetype fix, shebang/modeline detection, treesitter injection support