[git] Add diff-so-fancy as git diff

Added package diff-so-fancy and make diff use it by default for its
diffs by setting it as its diff-pager.

Added sanity function dsf which invokes diff-so-fancy if it exists or
degrades gracefully if it does not. Use this function for all git diff
needs.

Pre-fill the pager search term in git to enable jumping between changed
files with n/N.
This commit is contained in:
Marty Oehme 2020-05-28 13:35:57 +02:00
parent 17f8ca062d
commit d6a2ee7b8a
No known key found for this signature in database
GPG key ID: 0CCB0526EFB9611A
4 changed files with 31 additions and 0 deletions

18
git/.local/bin/dsf Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env sh
# Pretty git diff display
# degrade diffs gracefully:
# prefer diff-so-fancy if it is installed,
# otherwise fallback to git's own prettifier,
# if nothing exists just pass it on
dsf() {
if exist diff-so-fancy; then
diff-so-fancy
elif exist /usr/share/git/diff-highlight/diff-highlight; then
/usr/share/git/diff-highlight/diff-highlight
else
cat
fi
}
dsf