diff options
| author | Harsh Kapse <harshkapse1234@gmail.com> | 2026-03-17 17:41:55 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-17 12:11:55 +0000 |
| commit | a5b8cf145d1f46428f2eaa5fec89d41f5c9f87f7 (patch) | |
| tree | e8e3d89d2b6fa152400b9f63353caa6222bdd4c4 /runtime/lua/vim/_meta/options.lua | |
| parent | 9ab6c607ccc73f66ab90721f956c98bbca5cf267 (diff) | |
feat(diff): merge adjacent blocks using inline:word (#37085)
vim-patch:9.2.0174: diff: inline word-diffs can be fragmented
Problem: When using 'diffopt=inline:word', lines were excessively
fragmented with punctuation creating separate highlight
blocks, making it harder to read the diffs.
Solution: Added 'diff_refine_inline_word_highlight()' to merge
adjacent diff blocks that are separated by small gaps of
non-word characters (up to 5 bytes by default) (HarshK97).
When using inline:word diff mode, adjacent changed words separated by
punctuation or whitespace are now merged into a single highlight block
if the gap between them contains fewer than 5 non-word characters.
This creates more readable diffs and closely matches GitHub's own diff
display.
closes: vim/vim#19098
https://github.com/vim/vim/commit/42c6686c78d39843f71dba989a8ea59bc6975132
Diffstat (limited to 'runtime/lua/vim/_meta/options.lua')
| -rw-r--r-- | runtime/lua/vim/_meta/options.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 9b29d3380d..5e0c52bf7e 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -1873,7 +1873,10 @@ vim.go.dex = vim.go.diffexpr --- difference. Non-alphanumeric --- multi-byte characters such as emoji --- and CJK characters are considered ---- individual words. +--- individual words. Small gaps of +--- non-word characters (5 bytes or less) +--- between changes are merged into a +--- single highlight block. --- --- internal Use the internal diff library. This is --- ignored when 'diffexpr' is set. *E960* |
