All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
- Line-level diff now uses Neovim's built-in
vim.diff()(C xdiff library) instead of the pure-Lua Myers O(ND) implementation, delivering a 5–6× speedup on large files - Async thread machinery removed (
vim.uv.new_thread,_worker.lua, JSON encode/decode round-trip) —vim.diffis synchronous and fast enough for all file sizes
- Deleted
lua/inline-diff/_worker.lua compute_hunksis now synchronous (callback signature preserved for API compatibility)_myers_matchedretained for word-level (sub-line) diffing
- Word-level diff no longer splits multi-byte UTF-8 characters (CJK, accented letters, emoji) across token boundaries. Previously each byte of a multi-byte character was treated as a separate token, which could produce
nvim_buf_set_extmarkcalls with byte offsets landing mid-codepoint, causing garbled highlight rendering.
- 74 tests (up from 69); added
_tokenizeunit tests and multi-byte word-diff coverage
- Improved README with clearer setup and usage instructions
- Updated demo GIF
- Myers O(ND) algorithm now used for word-level diff, replacing the O(m×n) LCS
- Hunk cache: skip extmark clear+rebuild when hunks are unchanged between refreshes (common during typing)
- Synchronous diff path for files under 500 total lines, avoiding thread serialization overhead
decode_linesin worker no longer allocates a copy of the full content string
prev_hunkscache correctly invalidated when switching refs, preventing blank buffer afterrender.clear()
- 69 tests (up from 60); added
_hunks_equalunit tests and ref-switch invalidation coverage
- Windows:
git showpath spec now uses forward slashes; backslashes inrelpathcaused git to report "path exists on disk but not in HEAD" - Windows:
git showoutput with CRLF line endings no longer leaves trailing\ron every old line, which caused all lines to compare unequal - Thread worker: if
require("inline-diff._worker")fails in the background thread (e.g. due topackage.pathresolution differences), the diff now falls back to synchronous computation on the main thread instead of silently producing no output
- Diff computation runs off the main thread via
vim.uv.new_thread, keeping the UI responsive on large files
[ref]argument on all commands and the Lua API — diff against any git ref per invocation without changing the default (HEAD~1, a branch, a SHA, …)stagedref: diff against the git index (what you'vegit add-ed); falls back toHEADautomatically when the file has no staged content
- Auto-scroll now correctly reveals all bottom virtual lines when the last buffer line wraps to more than one visual row
- Auto-scroll no longer crashes when
topline == buf_line_count
- Removed redundant O(m+n) line-copy in
_diff_lines - LCS dp-table initialization reduced from O(m×n) to O(m+n) by only pre-filling boundary rows/cols
compute_hunksnow delivers results synchronously, saving one event-loop round-trip per keystroke
- Expanded test suite to 56 tests; added dedicated
scroll_spec.lua
- Initial implementation: live inline diff against a git ref with word-level highlighting
InlineDiffEnable,InlineDiffDisable,InlineDiff(toggle) commandssetup(),enable(),disable(),toggle()Lua API- Highlight groups derived from colorscheme's
DiffAdd/DiffDelete, recomputed onColorScheme - Debounced live updates on
TextChanged/TextChangedI - Auto-scroll to reveal virtual lines at buffer edges (top/bottom deletions)
- Pure Lua LCS-based line diff — no
git diffsubprocess - Git repo root and HEAD ref content cached per buffer; invalidated on
BufWritePost,BufReadPost, andFocusGained CursorMovedscroll adjustment short-circuited when no edge virtual lines exist- Identifier-boundary word tokenization:
vim.o.something→vim.o.{foobar}highlights only the changed part
- Word-level highlight colors, layering, and foreground contrast
- Buffer reload via
:e!now correctly refreshes the diff