This plugin is an additional vim syntax for diff format and highlights changed and added diff units on word or character basis.
For example, a diff file in unified format will be shown like this:
This syntax plugin does:
- identify either of unified, context, or normal "ed" style diff format, which can be provided by some program like diff and git diff commands
- find corresponding changed lines to be compared
- split each line to a list of diff units, based on the
DiffUnit
buffer-local or global variable - compare them and find the changed and added units, using a builtin
diff()
function or a plugin specific function along with thediffopt
option - show those units in single or several background-colored syntax highlights,
based on the
DiffColors
buffer-local or global variable
In addition to those diff formats, if the file extension is ".diff" or the
syntax
option is set to "diff", this syntax plugin identifies a file
including git conflict markers and shows the diff units like this:
-
b:DiffUnit
,g:DiffUnit
: A type of diff unitValue Description 'Char' any single character 'Word1' \w\+
word and any\W
single character (default)'Word2' non-space and space words 'Word3' \<
or\>
character class boundaries (set byiskeyword
option)'word' see word
'WORD' see WORD
-
b:DiffColors
,g:DiffColors
: Highlight group for changed units (hl-DiffAdd
for added units)Value Description 0 hl-DiffChange
1 hl-DiffChange
+ several highlight groups (default) -
b:DiffUnitSyntax
,g:DiffUnitSyntax
: Enable or disable this syntax pluginValue Description 0 disable 1 enable (default)