In another post I found the very neat
git diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+'
which does a great job at compressing git-diff
's output to the essential while remaining legible (especially when adding --word-diff=plain
for additional [-
/-]
and {+
/+}
surrounding deletions/additions). While this does include whitespace changes, the output does not highlight them in any noticeable way, e.g. when changing the indentation of a line of python code (which is a severe change) will show up as that line with the longer indentation (before or after), but there is no highlighting whatsoever.
How can whitespace changes be hightlighted correctly, maybe by replacing whitespace by some unicode characters such as ·
, ⇥
and ↵
, or something more close to git diff --word-diff-regex=.
's {+ +}
etc but with the smarter word separation?