A simple plugin integrating so-fancy/diff-so-fancy into Zsh. It provides:
git dsf
: A subcommand to run Git diffs through diff-so-fancyfancy-diff
: A helper to run a unified diff and beautify it with diff-so-fancy
- Install diff-so-fancy or load it via your preferred method.
- Load the plugin in your
.zshrc
or plugin manager:# Example using Zi zi ice as'program' pick'bin/*' zi light z-shell/zsh-diff-so-fancy
- Use the commands:
git dsf <files>
to see a diff rendered by diff-so-fancyfancy-diff <file1> <file2>
to compare two files with diff-so-fancy
diff-so-fancy --colors # Show recommended color config
diff-so-fancy --set-defaults # Configure Git to use diff-so-fancy with suggested colors
diff-so-fancy --patch # Patch mode, interoperable with `git add --patch`
# Use diff-so-fancy for all diffs
git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
# Use diff-so-fancy for `git add --patch`
git config --global interactive.diffFilter "diff-so-fancy --patch"
- markEmptyLines (bool, default: true) Color the first block of an empty line.
- changeHunkIndicators (bool, default: true) Simplify Git header chunks to a more readable format.
- stripLeadingSymbols (bool, default: true)
Remove leading
+
or-
from lines. - useUnicodeRuler (bool, default: true) Use Unicode line-drawing characters for file headers (disable if your terminal cannot display them).
- rulerWidth (int, default: full width) Set a fixed width for the file header separator.
Installation with Zi
zi ice as'null' sbin'bin/*'
zi light z-shell/zsh-diff-so-fancy
Or:
zi ice as'program' pick'bin/*'
zi light z-shell/zsh-diff-so-fancy
This places diff-so-fancy
, fancy-diff
, and git-dsf
in $PATH
, adding the dsf
subcommand to Git automatically.
- Zplug
zplug "z-shell/zsh-diff-so-fancy", as:command, use:"bin/"
- Zgen
zgen load z-shell/zsh-diff-so-fancy