[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:
parent
17f8ca062d
commit
d6a2ee7b8a
4 changed files with 31 additions and 0 deletions
18
git/.local/bin/dsf
Executable file
18
git/.local/bin/dsf
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue