A syntax-highlighting pager for git, diff, and grep output
Go to file
2019-07-16 14:04:13 -04:00
assets Use syntax and theme data built by bat. Fixes #4, #5 2019-06-29 18:12:57 -04:00
completion/bash bash completion 2019-06-30 16:24:44 -04:00
HomeBrewFormula Homebrew formula 2019-07-16 14:04:13 -04:00
src Tweak light theme colors 2019-07-16 13:09:05 -04:00
.gitignore gitignore 2019-07-08 23:51:09 -04:00
.travis.yml Copy travis CI config from bat 2019-07-15 14:37:34 -04:00
Cargo.toml Refactor: box drawing module 2019-07-12 01:05:32 -04:00
ci Copy travis CI config from bat 2019-07-15 14:37:34 -04:00
LICENSE Add license 2019-07-01 00:48:49 -04:00
Makefile Style section arguments 2019-07-13 00:42:58 -04:00
README.md README: screenshots 2019-07-16 13:41:58 -04:00

Build Status

Δ

A syntax-highlighting pager for git.

image image
delta --dark (default) delta --light

Installation

brew tap dandavison/delta https://github.com/dandavison/delta
brew install dandavison/delta/git-delta

Alternatively, executables for your platform can be downloaded at https://github.com/dandavison/delta/releases.

Configure git to use delta

git config --global core.pager "delta --dark"  # --light for light terminal backgrounds

Alternatively, you can edit your .gitconfig directly. An example is

[core]
    pager = delta --plus-color="#012800" --minus-color="#340001" --theme="base16-ocean.dark"

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

Usage

USAGE:
    delta [FLAGS] [OPTIONS]

FLAGS:
        --compare-themes       Compare available syntax highlighting themes. To use this option, supply git diff output
                               to delta on standard input. For example: `git show --color=always | delta --compare-
                               themes`.
        --dark                 Use colors appropriate for a dark terminal background.  For more control, see --theme,
                               --plus-color, and --minus-color.
    -h, --help                 Prints help information
        --highlight-removed    Apply syntax highlighting to removed lines. The default is to apply syntax highlighting
                               to unchanged and new lines only.
        --light                Use colors appropriate for a light terminal background. For more control, see --theme,
                               --plus-color, and --minus-color.
        --list-languages       List supported languages and associated file extensions.
        --list-themes          List available syntax highlighting themes.
    -V, --version              Prints version information

OPTIONS:
        --commit-style <commit_style>
            Formatting style for commit section of git output. Options are: plain, box. [default: plain]

        --file-style <file_style>
            Formatting style for file section of git output. Options are: plain, box, underline. [default: underline]

        --hunk-style <hunk_style>
            Formatting style for hunk section of git output. Options are: plain, box. [default: box]

        --minus-color <minus_color>              The background color (RGB hex) to use for removed lines.
        --minus-emph-color <minus_emph_color>
            The background color (RGB hex) to use for emphasized sections of removed lines.

        --plus-color <plus_color>                The background color (RGB hex) to use for added lines.
        --plus-emph-color <plus_emph_color>
            The background color (RGB hex) to use for emphasized sections of added lines.

        --theme <theme>                          The syntax highlighting theme to use.
    -w, --width <width>
            The width (in characters) of the background color highlighting. By default, the width is the current
            terminal width. Use --width=variable to apply background colors to the end of each line, without right
            padding to equal width.

24 bit color

delta works best if your terminal application supports 24 bit colors. See https://gist.github.com/XVilka/8346728. For example, on macos, iTerm2 works but Terminal.app does not.

If you're using tmux, it's worth checking that 24 bit color is working correctly. For example, run a color test script like this one, or the others listed at https://gist.github.com/XVilka/8346728. If you do not see smooth color gradients, see the discussion at tmux#696. The short version is you need something like this in your ~/.tmux.conf:

set -ga terminal-overrides ",xterm-256color:Tc"

and you may then need to quit tmux completely for it to take effect.

Credit

https://github.com/trishume/syntect
https://github.com/sharkdp/bat
https://github.com/so-fancy/diff-so-fancy