dotfiles/git/.local/bin/dsf
Marty Oehme d6a2ee7b8a
[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.
2020-05-28 13:51:02 +02:00

18 lines
395 B
Bash
Executable file

#!/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