Skip to main content

⚙️ Diff So Fancy


The wrapper around so-fancy/diff-so-fancy to use with Zsh helps to improve code quality and spot defects faster.

The plugin adds the subcommand dsf to git, and provides the command fancy-diff to pipe the diff output to diff-so-fancy:

  • git dsf to see the diff output.
  • fancy-diff <file1> <file2> to pipe the diff output.
  • diff-so-fancy -h to see the help.

Install Diff-So-Fancy

Add the following to your .zshrc file:

Using bin-gem-node annex (recommended):

zi ice as'null' sbin'bin/*'
zi light z-shell/zsh-diff-so-fancy

Standard installation:

zi ice as'program' pick'bin/*'
zi light z-shell/zsh-diff-so-fancy

This will add diff-so-fancy, fancy-diff, and git-dsf to $PATH and automatically equip git with the subcommand dsf.

diff-so-fancy --colors

Configure git-diff to use diff-so-fancy and suggested colors:

diff-so-fancy --set-defaults

Use diff-so-fancy in patch mode (interoperable with git add --patch):

diff-so-fancy --patch

Configure git to use diff-so-fancy for all diff operations:

git config --global core.pager "diff-so-fancy | less --tabs=4 -RFXS"

Configure git to use diff-so-fancy for git add --patch:

git config --global interactive.diffFilter "diff-so-fancy --patch"


Should the first block of an empty line be colored? (Default: true)

git config --bool --global diff-so-fancy.markEmptyLines false


Simplify git header chunks to a more human-readable format. (Default: true)

git config --bool --global diff-so-fancy.changeHunkIndicators false


Should the pesky + or - at the line start be removed? (Default: true)

git config --bool --global diff-so-fancy.stripLeadingSymbols false


By default, the separator for the file header uses Unicode line-drawing characters. If this is causing output errors on your terminal, set this to false to use ASCII characters instead. (Default: true)

git config --bool --global diff-so-fancy.useUnicodeRuler false


By default, the separator for the file header spans the full width of the terminal. Use this setting to set the width of the file header manually.

git config --global diff-so-fancy.rulerWidth 47    # git log's commit header width