Arch Linux AUR
(build from source) |
yay -S git-delta
or
git clone https://aur.archlinux.org/git-delta.git
cd git-delta
makepkg -csri |
Arch Linux AUR
(binary, no compilation required) |
yay -S git-delta-bin
or
git clone https://aur.archlinux.org/git-delta-bin.git
cd git-delta-bin
makepkg -si |
Cargo |
cargo install git-delta |
Debian / Ubuntu |
.deb files are on the releases page and at barnumbirr/delta-debian
dpkg -i file.deb . **IMPORTANT** If you are using Ubuntu <= 19.10 or are mixing apt sources, read https://github.com/dandavison/delta/issues/504, be extremely cautious, and try the versions linked against musl. |
Fedora |
dnf install git-delta |
FreeBSD |
pkg install git-delta |
Gentoo |
emerge dev-util/git-delta |
Homebrew |
brew install git-delta |
MacPorts |
port install git-delta |
Nix |
nix-env -iA nixpkgs.gitAndTools.delta
|
openSUSE Tumbleweed |
zypper install git-delta
|
Void Linux |
xbps-install -S delta
|
Windows (Chocolatey) |
choco install delta |
Windows (Scoop) |
scoop install delta |
Users of older MacOS versions (e.g. 10.11 El Capitan) should install using Homebrew, Cargo, or MacPorts: the binaries on the release page will not work.
See [repology.org/git-delta](https://repology.org/project/git-delta/versions) for the current version in each package repository.
Behind the scenes, delta uses `less` for paging. The version of `less` that comes with your operating system may be too old (currently, less v551 is a good choice). On MacOS, install `less` from Homebrew. For Windows, see [Using Delta on Windows](#using-delta-on-windows).
## Configuration
#### Git config files
Set delta to be git's pager in your `.gitconfig`. Delta has many options to alter colors and other details of the output; `delta --help` shows them all. An example is
```gitconfig
[core]
pager = delta
[delta]
plus-style = "syntax #012800"
minus-style = "syntax #340001"
syntax-theme = Monokai Extended
navigate = true
[interactive]
diffFilter = delta --color-only
```
Note that delta style argument values in ~/.gitconfig should be in double quotes, like `--minus-style="syntax #340001"`. For theme names and other values, do not use quotes as they will be passed on to delta, like `theme = Monokai Extended`.
All git commands that display diff output should now display syntax-highlighted output. For example:
- `git diff`
- `git show`
- `git log -p`
- `git stash show -p`
- `git reflog -p`
- `git add -p`
For Mercurial, you can add delta, with its command line options, to the `[pager]` section of `.hgrc`.
Delta also handles unified diff output, and can be used as an alternative way of invoking `diff -u`. The following two commands do the same thing:
```
delta a.txt b.txt
diff -u a.txt b.txt | delta
```
#### Environment
##### a) Delta
Delta respects the setting of some environment variables to derive the default pager to use. These are in descending order of priority :
- `DELTA_PAGER`,
- `BAT_PAGER` and
- `PAGER`
Hence if e.g. `$DELTA_PAGER` is unset, delta will use `$BAT_PAGER`, or `$PAGER` if that is unset, too. In environments without any of the three variable set, delta's fallback is `less`.
##### b) Third party apps
Note that `$BAT_PAGER` (as well as `$PAGER`) is _also_ used by the standalone `bat` app. Please see `bat(1)` for a [description](https://jlk.fjfi.cvut.cz/arch/manpages/man/community/bat/bat.1.en). However, `$BAT_THEME`, `$BAT_STYLE` and `$BAT_CONFIG_PATH` are **not** used by delta.
The behavior of delta's default pager, less, can be controlled using the `LESS` environment variable. It may contain any of the `less` command line options and/or interactive less-commands (prefixed by a leading `+` sign) which will be executed every time right after less is launched. A real-life example for the latter would be `LESS='+Gg'`, causing the pager to briefly jump to the bottom of the buffer and back to the top right afterwards. The purpose of this example is to enable the full metadata display in less' status line, including the buffer contents length and relative position of the current view port, in percent and lines/characters.
Less also uses a bunch of other environment variables as well as config files, although most of them are not relevant for use in combination with delta. For an in-depth explanation of these configuration options please see the `less(1)` [manual](https://jlk.fjfi.cvut.cz/arch/manpages/man/core/less/less.1.en).
It should also be mentioned that, besides using the `core.pager` setting, you can also set `GIT_PAGER=delta` in your environment in order to define the default `git` pager. If set, this variable will take priority above the setting in the git config file(s).
## Usage
### Choosing colors (styles)
All options that have a name like `--*-style` work in the same way. It is very similar to how
colors/styles are specified in a gitconfig file:
https://git-scm.com/docs/git-config#Documentation/git-config.txt-color
Here's an example:
```gitconfig
[delta]
minus-style = red bold ul "#ffeeee"
```
That means: For removed lines, set the foreground (text) color to 'red', make it bold and underlined, and set the background color to `#ffeeee`.
For full details, see the `STYLES` section in [`delta --help`](#full---help-output).
### Line numbers
```gitconfig
[delta]
line-numbers = true
```