I am making changes to an existing C code. If I just want to check my changes, I can easily use vimdiff
for that, with old & modified files.
What I want is to limit some syntax highlighting to just the diff
part.
Particularly I need to highlight TABS, but only those TABS contained within DiffAdd
& DiffChange
sections/regions.
What I tried:
syntax region TESTRGN start="TESTRGN_START" end="TESTRGN_END"
highlight TESTRGN ctermbg=lightgreen guibg=lightgreen
syntax match LeadingTabsInRegion display contained containedin=TESTRGN /^\( *\t\+\)\+/
highlight LeadingTabsInRegion ctermbg=darkred guibg=darkred
Above snippet highlights the leading TABS within TESTRGN
& tabs in remaining file remain un-highlighted.
However, if I change TESTRGN to DiffAdd in the syntax match
line, it does not work as I expected.
My understanding is that DiffAdd
is not a region defined using syntax region ...
& hence containedin=DiffAdd
does not work.
So is there any method/work-around for doing what I am trying to do?