README.md
1<p align="center">
2 <img width=400px src="https://user-images.githubusercontent.com/52205/102416950-ae124300-3ff2-11eb-9d66-40d2aef4888f.png" alt="image" />
3</p>
4<p align="center">
5 <a href="https://github.com/dandavison/delta/actions">
6 <img src="https://github.com/dandavison/delta/workflows/Continuous%20Integration/badge.svg" alt="CI">
7 </a>
8 <a href="https://coveralls.io/github/dandavison/delta?branch=master">
9 <img src="https://coveralls.io/repos/github/dandavison/delta/badge.svg?branch=master" alt="Coverage Status">
10 </a>
11 <a href="https://gitter.im/dandavison-delta/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge">
12 <img src="https://badges.gitter.im/dandavison-delta/community.svg" alt="Gitter">
13 </a>
14</p>
15
16## Get Started
17
18[Install](#installation) delta and add this to your `~/.gitconfig`:
19
20```gitconfig
21[pager]
22 diff = delta
23 log = delta
24 reflog = delta
25 show = delta
26
27[interactive]
28 diffFilter = delta --color-only --features=interactive
29```
30
31## A syntax-highlighting pager for git and diff output
32
33Code evolves, and we all spend time studying diffs. Delta aims to make this both efficient and enjoyable: it allows you to make extensive changes to the layout and styling of diffs, as well as allowing you to stay arbitrarily close to the default git/diff output.
34
35<table>
36 <tr>
37 <td>
38 <img width=400px src="https://user-images.githubusercontent.com/52205/86275526-76792100-bba1-11ea-9e78-6be9baa80b29.png" alt="image" />
39 <br>
40 <sub>delta with <code>line-numbers</code> activated</sub>
41 </td>
42 </tr>
43</table>
44
45<table>
46 <tr>
47 <td>
48 <img width=800px src="https://user-images.githubusercontent.com/52205/87230973-412eb900-c381-11ea-8aec-cc200290bd1b.png" alt="image" />
49 <br>
50 <sub>delta with <code>side-by-side</code> and <code>line-numbers</code> activated</sub>
51 </td>
52 </tr>
53</table>
54
55# Contents
56
57- [Features](#features)
58- [Installation](#installation)
59- [Configuration](#configuration)
60 - [Git config file](#git-config-file)
61 - [Environment](#environment)
62- [Usage](#usage)
63 - [Choosing colors (styles)](#choosing-colors-styles)
64 - [Line numbers](#line-numbers)
65 - [Side-by-side view](#side-by-side-view)
66 - ["Features": named groups of settings](#features-named-groups-of-settings)
67 - [Custom themes](#custom-themes)
68 - [diff-highlight and diff-so-fancy emulation](#diff-highlight-and-diff-so-fancy-emulation)
69 - [--color-moved support](#--color-moved-support)
70 - [Navigation keybindings for large diffs](#navigation-keybindings-for-large-diffs)
71 - [24 bit color (truecolor)](#24-bit-color-truecolor)
72 - [Using Delta on Windows](#using-delta-on-windows)
73 - [Mouse scrolling](#mouse-scrolling)
74 - [Using Delta with Magit](#using-delta-with-magit)
75 - [Supported languages and themes](#supported-languages-and-themes)
76- [Comparisons with other tools](#comparisons-with-other-tools)
77- [Build delta from source](#build-delta-from-source)
78- [Related projects](#related-projects)
79 - [Used by delta](#used-by-delta)
80 - [Using delta](#using-delta)
81 - [Similar projects](#similar-projects)
82- [Full --help output](#full---help-output)
83- [Delta configs used in screenshots](#delta-configs-used-in-screenshots)
84 - [Side-by-side view](#side-by-side-view-1)
85
86Here's what `git show` can look like with git configured to use delta:
87
88<br>
89
90<table>
91 <tr>
92 <td>
93 <img width=500px style="border: 1px solid black"
94 src="https://user-images.githubusercontent.com/52205/81058545-a5725f80-8e9c-11ea-912e-d21954586a44.png"
95 alt="image" />
96 </td>
97 <td>
98 <img width=500px style="border: 1px solid black"
99 src="https://user-images.githubusercontent.com/52205/81058911-6abcf700-8e9d-11ea-93be-e212824ec03d.png"
100 alt="image" />
101 </td>
102 </tr>
103 <tr>
104 <td>
105 "Dracula" theme
106 </td>
107 <td>
108 "GitHub" theme
109 </td>
110 </tr>
111</table>
112
113<br>
114<br>
115
116**All the syntax-highlighting color themes that are available with [bat](https://github.com/sharkdp/bat/) are available with delta:**
117
118<br>
119<table>
120 <tr>
121 <td>
122 <img width=500px style="border: 1px solid black"
123 src="https://user-images.githubusercontent.com/52205/80850197-b8f5a000-8be8-11ea-8c9e-29c5b213c4b7.png"
124 alt="image" />
125 </td>
126 <td>
127 <img width=450px style="border: 1px solid black"
128 src="https://user-images.githubusercontent.com/52205/80850237-e04c6d00-8be8-11ea-9027-0d2ea62f15c2.png"
129 alt="image" />
130 </td>
131 </tr>
132 <tr>
133 <td>
134 <code>delta --show-syntax-themes --dark</code>
135 </td>
136 <td>
137 <code>delta --show-syntax-themes --light</code>
138 </td>
139 </tr>
140</table>
141
142<br>
143
144## Features
145
146- Language syntax highlighting with color themes
147- Within-line highlights based on a Levenshtein edit inference algorithm
148- Git style strings (foreground color, background color, font attributes) are supported for >20 stylable elements
149- Side-by-side view
150- Line numbering
151- `diff-highlight` and `diff-so-fancy` emulation modes
152- Stylable box/line decorations to draw attention to commit, file and hunk header sections.
153- Support for Git's `--color-moved` feature.
154- Code can be copied directly from the diff (`-/+` markers are removed by default).
155- `n` and `N` keybindings to move between files in large diffs, and between diffs in `log -p` views (`--navigate`)
156- Commit hashes can be formatted as terminal [hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) to the GitHub/GitLab/Bitbucket page (`--hyperlinks`).
157 File paths can also be formatted as hyperlinks for opening in your OS.
158
159| | delta | git | [diff-so-fancy] /<br>[diff-highlight] | github/gitlab |
160| ---------------------------------------------- | ----- | --- | ------------------------------------- | ------------- |
161| language syntax highlighting | ✅ | ❌ | ❌ | ✅ |
162| within-line insertion/deletion detection | ✅ | ❌ | ✅ | ✅ |
163| multiple insertion/deletions detected per line | ✅ | ❌ | ❌ | ✅ |
164| matching of unequal numbers of changed lines | ✅ | ❌ | ❌ | ❌ |
165| independently stylable elements | ✅ | ✅ | ✅ | ❌ |
166| line numbering | ✅ | ❌ | ❌ | ✅ |
167| side-by-side view | ✅ | ❌ | ❌ | ✅ |
168
169In addition, delta handles traditional unified diff output.
170
171[diff-so-fancy]: https://github.com/so-fancy/diff-so-fancy
172[diff-highlight]: https://github.com/git/git/tree/master/contrib/diff-highlight
173
174## Installation
175
176You can download an executable for your system:
177[Linux (glibc)](https://github.com/dandavison/delta/releases/download/0.9.1/delta-0.9.1-x86_64-unknown-linux-gnu.tar.gz)
178|
179[Linux (musl)](https://github.com/dandavison/delta/releases/download/0.9.1/delta-0.9.1-x86_64-unknown-linux-musl.tar.gz)
180|
181[MacOS](https://github.com/dandavison/delta/releases/download/0.9.1/delta-0.9.1-x86_64-apple-darwin.tar.gz)
182|
183[Windows](https://github.com/dandavison/delta/releases/download/0.9.1/delta-0.9.1-x86_64-pc-windows-msvc.zip)
184|
185[All](https://github.com/dandavison/delta/releases)
186
187Alternatively you can install delta using a package manager: see [repology.org/git-delta](https://repology.org/project/git-delta/versions).
188
189Note that the package is often called `git-delta`, but the executable installed is called `delta`. Here is a quick sumary for selected package managers:
190
191<table>
192 <tr>
193 <td><a href="https://archlinux.org/packages/community/x86_64/git-delta/">Arch Linux</a></td>
194 <td><code>pacman -S git-delta</code></td>
195 </tr>
196 <tr>
197 <td><a href="https://crates.io/crates/git-delta">Cargo</a></td>
198 <td><code>cargo install git-delta</code></td>
199 </tr>
200 <tr>
201 <td><a href="https://src.fedoraproject.org/rpms/rust-git-delta">Fedora</a></td>
202 <td><code>dnf install git-delta</code></td>
203 </tr>
204 <tr>
205 <td><a href="https://pkgs.org/download/git-delta">FreeBSD</a></td>
206 <td><code>pkg install git-delta</code></td>
207 </tr>
208 <tr>
209 <td><a href="https://packages.gentoo.org/packages/dev-util/git-delta">Gentoo</a></td>
210 <td><code>emerge dev-util/git-delta</code></td>
211 </tr>
212 <tr>
213 <td><a href="https://formulae.brew.sh/formula/git-delta">Homebrew</a></td>
214 <td><code>brew install git-delta</code></td>
215 </tr>
216 <tr>
217 <td><a href="https://ports.macports.org/port/git-delta/summary">MacPorts</a></td>
218 <td><code>port install git-delta</code></td>
219 </tr>
220 <tr>
221 <td><a href="https://search.nixos.org/packages?show=delta&query=delta">Nix</a></td>
222 <td><code>nix-env -iA nixpkgs.delta</code>
223 </tr>
224 <tr>
225 <td><a href="https://software.opensuse.org/package/git-delta">openSUSE Tumbleweed</a></td>
226 <td><code>zypper install git-delta</code>
227 </tr>
228 <tr>
229 <td><a href="https://github.com/void-linux/void-packages/tree/master/srcpkgs/delta">Void Linux</a></td>
230 <td><code>xbps-install -S delta</code>
231 </tr>
232 <tr>
233 <td>Windows (<a href="https://chocolatey.org/packages/delta">Chocolatey</a>)</td>
234 <td><code>choco install delta</code></td>
235 </tr>
236 <tr>
237 <td>Windows (<a href="https://scoop.sh/">Scoop</a>)</td>
238 <td><code>scoop install delta</code></td>
239 </tr>
240 <tr>
241 <td>Debian / Ubuntu</td>
242 <td>
243 <code>dpkg -i file.deb</code>
244 <br>
245 .deb files are on the <a href="https://github.com/dandavison/delta/releases">releases</a> page.
246 <br>
247 <sup><b>IMPORTANT</b>: If you are using Ubuntu <= 19.10 or are mixing apt sources, read <a href="https://github.com/dandavison/delta/issues/504">#504</a>, be extremely cautious, and try the versions linked against musl.</sup>
248 </td>
249 </tr>
250</table>
251
252Users 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.
253
254Behind the scenes, delta uses [`less`](https://www.greenwoodsoftware.com/less/) for paging.
255It's important to have a reasonably recent version of less installed.
256On MacOS, install `less` from Homebrew. For Windows, see [Using Delta on Windows](#using-delta-on-windows).
257
258## Configuration
259
260#### Git config file
261
262The most convenient way to configure delta is with a `[delta]` section in `~/.gitconfig`. Here's an example:
263
264<sub>
265
266```gitconfig
267[pager]
268 diff = delta
269 log = delta
270 reflog = delta
271 show = delta
272
273[interactive]
274 diffFilter = delta --color-only --features=interactive
275
276[delta]
277 features = decorations
278
279[delta "interactive"]
280 keep-plus-minus-markers = false
281
282[delta "decorations"]
283 commit-decoration-style = blue ol
284 commit-style = raw
285 file-style = omit
286 hunk-header-decoration-style = blue box
287 hunk-header-file-style = red
288 hunk-header-line-number-style = "#067a00"
289 hunk-header-style = file line-number syntax
290```
291
292</sub>
293
294Use `delta --help` to see all the available options.
295
296Note 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`.
297
298All git commands that display diff output should now display syntax-highlighted output. For example:
299
300- `git diff`
301- `git show`
302- `git log -p`
303- `git stash show -p`
304- `git reflog -p`
305- `git add -p`
306
307To change your delta options in a one-off git command, use `git -c`. For example
308
309```
310git -c delta.line-numbers=false show
311```
312
313Delta can also be used as a shorthand for diffing two files: the following two commands do the same thing:
314
315```
316delta a.txt b.txt
317
318git diff a.txt b.txt
319```
320
321Delta also handles unified diff format, e.g. `diff -u a.txt b.txt | delta`.
322
323For Mercurial, you can add delta, with its command line options, to the `[pager]` section of `.hgrc`.
324
325#### Environment
326
327Delta acts as a pager for git's output, and delta in turn passes its own output on to a "real" pager.
328The pager that delta uses is determined by consulting the following environment variables (in this order):
329
330- `DELTA_PAGER`
331- `PAGER`
332
333If neither is set, delta's fallback is `less -R`.
334
335The behavior of delta's default pager, `less`, can be controlled using the `LESS` environment variable.
336It may contain any of the `less` command line options and/or interactive less-commands (prefixed by a leading `+` sign; these are executed every time right after less is launched).
337For full documentation of `less` configuration options, please see the `less(1)` [manual](https://jlk.fjfi.cvut.cz/arch/manpages/man/core/less/less.1.en).
338
339In addition to `DELTA_PAGER`, and `PAGER`, delta currently also consults `$BAT_PAGER` (with priority between the two).
340However, this is deprecated: please use `DELTA_PAGER` instead.
341No other [`bat`](https://github.com/sharkdp/bat) environment variables are used by delta.
342
343## Usage
344
345### Choosing colors (styles)
346
347All options that have a name like `--*-style` work in the same way. It is very similar to how
348colors/styles are specified in a gitconfig file:
349https://git-scm.com/docs/git-config#Documentation/git-config.txt-color
350
351Here's an example:
352
353```gitconfig
354[delta]
355 minus-style = red bold ul "#ffeeee"
356```
357
358That means: For removed lines, set the foreground (text) color to 'red', make it bold and underlined, and set the background color to `#ffeeee`.
359
360For full details, see the `STYLES` section in [`delta --help`](#full---help-output).
361
362### Line numbers
363
364```gitconfig
365[delta]
366 line-numbers = true
367```
368
369<table><tr><td><img width=400px src="https://user-images.githubusercontent.com/52205/86275526-76792100-bba1-11ea-9e78-6be9baa80b29.png" alt="image" /></td></tr></table>
370
371The numbers are displayed in two columns and there are several configuration options: see the `LINE NUMBERS` section in [`delta --help`](#full---help-output) for details, and see the next section for an example of configuring line numbers.
372
373### Side-by-side view
374
375```gitconfig
376[delta]
377 side-by-side = true
378```
379
380By default, side-by-side view has line-numbers activated, and has syntax highlighting in both the left and right panels: [[config](#side-by-side-view-1)]
381
382<table><tr><td><img width=800px src="https://user-images.githubusercontent.com/52205/87230973-412eb900-c381-11ea-8aec-cc200290bd1b.png" alt="image" /></td></tr></table>
383
384To disable the line numbers in side-by-side view, but keep a vertical delimiter line between the left and right panels, use the line-numbers format options. For example:
385
386```gitconfig
387[delta]
388 side-by-side = true
389 line-numbers-left-format = ""
390 line-numbers-right-format = "│ "
391```
392
393Long lines are wrapped if they do not fit in side-by-side mode.
394In the image below, the long deleted line in the left panel overflows by a small amount, and the wrapped content is right-aligned in the next line.
395In contrast, the long replacement line in the right panel overflows by almost an entire line, and so the wrapped content is left aligned in the next line. The arrow markers and ellipsis explain when and how text has been wrapped.
396
397<table><tr><td><img width=600px src="https://user-images.githubusercontent.com/52205/139064537-f8479504-16d3-429a-b4f6-d0122438adaa.png" alt="image" /></td></tr></table>
398
399For control over the details of line wrapping, see `--wrap-max-lines`, `--wrap-left-symbol`, `--wrap-right-symbol`, `--wrap-right-percent`, `--wrap-right-prefix-symbol`, `--inline-hint-style`.
400Line wrapping was implemented by @th1000s.
401
402### "Features": named groups of settings
403
404All delta options can go under the `[delta]` section in your git config file. However, you can also use named "features" to keep things organized: these are sections in git config like `[delta "my-feature"]`. Here's an example using two custom features:
405
406```gitconfig
407[delta]
408 features = unobtrusive-line-numbers decorations
409 whitespace-error-style = 22 reverse
410
411[delta "unobtrusive-line-numbers"]
412 line-numbers = true
413 line-numbers-minus-style = "#444444"
414 line-numbers-zero-style = "#444444"
415 line-numbers-plus-style = "#444444"
416 line-numbers-left-format = "{nm:>4}┊"
417 line-numbers-right-format = "{np:>4}│"
418 line-numbers-left-style = blue
419 line-numbers-right-style = blue
420
421[delta "decorations"]
422 commit-decoration-style = bold yellow box ul
423 file-style = bold yellow ul
424 file-decoration-style = none
425 hunk-header-decoration-style = yellow box
426```
427
428<table><tr><td><img width=400px src="https://user-images.githubusercontent.com/52205/86275048-a96ee500-bba0-11ea-8a19-584f69758aee.png" alt="image" /></td></tr></table>
429
430### Custom themes
431
432A "theme" in delta is just a collection of settings grouped together in a named [feature](#features-named-groups-of-settings). One of the available settings is `syntax-theme`: this dictates the colors and styles that are applied to foreground text by the syntax highlighter. Thus the concept of "theme" in delta encompasses not just the foreground syntax-highlighting color theme, but also background colors, decorations such as boxes and under/overlines, etc.
433
434The delta git repo contains a [collection of themes](./themes.gitconfig) created by users. These focus on the visual appearance: colors etc. If you want features like `side-by-side` or `navigate`, you would set that yourself, after selecting the color theme. To use the delta themes, clone the delta repo (or download the [themes.gitconfig](./themes.gitconfig) file) and add the following entry in your gitconfig:
435
436```gitconfig
437[include]
438 path = /PATH/TO/delta/themes.gitconfig
439```
440
441Then, add your chosen color theme to your features list, e.g.
442
443```gitconfig
444[delta]
445 features = collared-trogon
446 side-by-side = true
447 ...
448```
449
450Note that this terminology differs from [bat](https://github.com/sharkdp/bat): bat does not apply background colors, and uses the term "theme" to refer to what delta calls `syntax-theme`. Delta does not have a setting named "theme": a theme is a "feature", so one uses `features` to select a theme.
451
452### diff-highlight and diff-so-fancy emulation
453
454Use `--diff-highlight` or `--diff-so-fancy` to activate the respective emulation mode.
455
456You may want to know which delta configuration values the emulation mode has selected, so that you can adjust them. To do that, use e.g. `delta --diff-so-fancy --show-config`:
457
458<table><tr><td><img width=300px src="https://user-images.githubusercontent.com/52205/86271121-5abe4c80-bb9a-11ea-950a-7c79502267d5.png" alt="image" /></td></tr></table>
459
460[diff-highlight](https://github.com/git/git/tree/master/contrib/diff-highlight) is a perl script distributed with git that allows within-line edits to be identified and highlighted according to colors specified in git config. [diff-so-fancy](https://github.com/so-fancy/diff-so-fancy) builds on diff-highlight, making various additional improvements to the default git diff output. Both tools provide very helpful ways of viewing diffs, and so delta provides emulation modes for both of them.
461
462The within-line highlighting rules employed by diff-highlight (and therefore by diff-so-fancy) are deliberately simpler than Delta's Levenshtein-type edit inference algorithm (see discussion in the [diff-highlight README](https://github.com/git/git/tree/master/contrib/diff-highlight)). diff-highlight's rules could be added to delta as an alternative highlighting algorithm, but that hasn't been done yet.
463
464### `--color-moved` support
465
466Recent versions of Git (≥ v2.17, April 2018) are able to detect moved blocks of code and style them differently from the usual removed/added lines. If you have activated this feature in Git, then Delta will automatically detect such differently-styled lines, and display them unchanged, i.e. with the raw colors it receives from Git.
467
468To activate the Git feature, use
469
470```gitconfig
471[diff]
472 colorMoved = default
473```
474
475and see the [Git documentation](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---color-movedltmodegt) for the other possible values and associated color configuration.
476
477In order to support this feature, Delta has to look at the raw colors it receives in a line from Git, and use them to judge whether it is a typical removed/added line, or a specially-colored moved line. This should just work. However, if it causes problems, the behavior can be disabled using
478
479```gitconfig
480[delta]
481 inspect-raw-lines = false
482```
483
484### Navigation keybindings for large diffs
485
486Use the `navigate` feature to activate navigation keybindings. In this mode, pressing `n` will jump forward to the next file in the diff, and `N` will jump backwards. If you are viewing multiple commits (e.g. via `git log -p`) then navigation will also visit commit boundaries.
487
488### 24 bit color (truecolor)
489
490Delta looks best if your terminal application supports 24 bit colors. See https://gist.github.com/XVilka/8346728. For example, on MacOS, iTerm2 supports 24-bit colors but Terminal.app does not.
491
492If your terminal application does not support 24-bit color, delta will still work, by automatically choosing the closest color from those available. See the `Colors` section of the help output below.
493
494If 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](https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh), or one of the others listed [here](https://gist.github.com/XVilka/8346728). If you do not see smooth color gradients, see the discussion at [tmux#696](https://github.com/tmux/tmux/issues/696). The short version is you need something like this in your `~/.tmux.conf`:
495
496```
497set -ga terminal-overrides ",xterm-256color:Tc"
498```
499
500and you may then need to quit tmux completely for it to take effect.
501
502### Using Delta on Windows
503
504Delta works on Windows. However, it is essential to use a recent version of `less.exe`: you can download one from https://github.com/jftuga/less-Windows/releases/latest. If you see incorrect colors and/or strange characters in Delta output, then it is probably because Delta is picking up an old version of `less.exe` on your system.
505
506### Mouse scrolling
507
508If mouse scrolling isn't working correctly, ensure that you have the most recent version of `less`.
509
510- For Windows you can download from https://github.com/jftuga/less-Windows/releases/latest
511- For Mac you can install `brew install less; brew link less`
512
513Alternatively try setting your `DELTA_PAGER` environment variable to (at least) `less -R`. See [issue #58](https://github.com/dandavison/delta/issues/58). See also [bat README / "Using a different pager"](https://github.com/sharkdp/bat#using-a-different-pager), since the `DELTA_PAGER` environment variable functions very similarly for delta.
514
515### Using Delta with Magit
516
517Delta can be used when displaying diffs in the Magit git client: see [magit-delta](https://github.com/dandavison/magit-delta). Here's a screenshot:
518
519<table><tr><td><img width=500px src="https://user-images.githubusercontent.com/52205/79934267-2acb2e00-8420-11ea-8bc4-546508fd3581.png" alt="image" /></td></tr></table>
520
521### Supported languages and themes
522
523To list the supported languages and color themes, use `delta --list-languages` and `delta --list-syntax-themes`. To see a demo of the color themes, use `delta --show-syntax-themes`:
524
525To add your own custom color theme, or language, please follow the instructions in the Customization section of the [bat documentation](https://github.com/sharkdp/bat/#customization):
526
527- [Adding a custom language](https://github.com/sharkdp/bat/#adding-new-syntaxes--language-definitions)
528- [Adding a custom theme](https://github.com/sharkdp/bat/#adding-new-themes)
529
530Delta automatically recognizes custom themes and languages added to bat. You will need to install bat in order to run the `bat cache --build` command.
531
532The languages and color themes that ship with delta are those that ship with bat. So, to propose a new language or color theme for inclusion in delta, it would need to be a helpful addition to bat, in which case please open a PR against bat.
533
534## Comparisons with other tools
535
536(`delta --light`)
537
538<table>
539 <tr>
540 <td>
541 delta vs. git
542 </td>
543 <td>
544 <img width=500px style="border: 1px solid black"
545 src="https://user-images.githubusercontent.com/52205/65248525-32250480-daea-11e9-9965-1a05c6a4bdf4.png"
546 alt="image" />
547 </td>
548 <td>
549 <img width=500px style="border: 1px solid black"
550 src="https://user-images.githubusercontent.com/52205/65248441-14f03600-daea-11e9-88a1-d96bbb6947f8.png"
551 alt="image" />
552 </td>
553 </tr>
554 <tr>
555 <td>
556 delta vs. diff-so-fancy /<br>diff-highlight
557 </td>
558 <td>
559 <img width=500px style="border: 1px solid black"
560 src="https://user-images.githubusercontent.com/52205/65248525-32250480-daea-11e9-9965-1a05c6a4bdf4.png"
561 alt="image" />
562 </td>
563 <td>
564 <img width=500px style="border: 1px solid black"
565 src="https://user-images.githubusercontent.com/52205/65248407-07d34700-daea-11e9-9a8f-6d81f4021abf.png"
566 alt="image" />
567 </td>
568 </tr>
569 <tr>
570 <td>
571 delta vs. github
572 </td>
573 <td>
574 <img width=500px style="border: 1px solid black"
575 src="https://user-images.githubusercontent.com/52205/65248525-32250480-daea-11e9-9965-1a05c6a4bdf4.png"
576 alt="image" />
577 </td>
578 <td>
579 <img width=500px style="border: 1px solid black"
580 src="https://user-images.githubusercontent.com/52205/65248749-9a73e600-daea-11e9-9c0d-29c8f1dea08e.png"
581 alt="image" />
582 </td>
583 </tr>
584</table>
585
586## Build delta from source
587
588You'll need to [install the rust tools](https://www.rust-lang.org/learn/get-started). Then:
589
590```
591cargo build --release
592```
593
594and use the executable found at `./target/release/delta`.
595
596## Related projects
597
598### Used by delta
599
600- [alacritty/vte](https://github.com/alacritty/vte)
601- [mitsuhiko/console](https://github.com/mitsuhiko/console)
602- [ogham/rust-ansi-term](https://github.com/ogham/rust-ansi-term)
603- [sharkdp/bat](https://github.com/sharkdp/bat)
604- [trishume/syntect](https://github.com/trishume/syntect)
605
606### Using delta
607
608- [bigH/git-fuzzy](https://github.com/bigH/git-fuzzy)
609- [dandavison/magit-delta](https://github.com/dandavison/magit-delta)
610- [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit/)
611- [junegunn/fzf.vim](https://github.com/junegunn/fzf.vim)
612- [ms-jpq/sad](https://github.com/ms-jpq/sad)
613- [wfxr/forgit](https://github.com/wfxr/forgit)
614
615### Similar projects
616
617- [da-x/fancydiff](https://github.com/da-x/fancydiff)
618- [git/diff-highlight](https://github.com/git/git/tree/master/contrib/diff-highlight)
619- [banga/git-split-diffs](https://github.com/banga/git-split-diffs)
620- [jeffkaufman/icdiff](https://github.com/jeffkaufman/icdiff)
621- [kovidgoyal/kitty-diff](https://sw.kovidgoyal.net/kitty/kittens/diff.html)
622- [mookid/diffr](https://github.com/mookid/diffr)
623- [so-fancy/diff-so-fancy](https://github.com/so-fancy/diff-so-fancy)
624
625## Full --help output
626
627```
628delta 0.9.1
629A viewer for git and diff output
630
631USAGE:
632 delta [FLAGS] [OPTIONS] [ARGS]
633
634FLAGS:
635 --light Use default colors appropriate for a light terminal background. For more control,
636 see the style options and --syntax-theme
637 --dark Use default colors appropriate for a dark terminal background. For more control,
638 see the style options and --syntax-theme
639 -n, --line-numbers Display line numbers next to the diff. See LINE NUMBERS section
640 -s, --side-by-side Display a side-by-side diff view instead of the traditional view
641 --diff-highlight Emulate diff-highlight (https://github.com/git/git/tree/master/contrib/diff-highlight)
642 --diff-so-fancy Emulate diff-so-fancy (https://github.com/so-fancy/diff-so-fancy)
643 --navigate Activate diff navigation: use n to jump forwards and N to jump backwards. To change
644 the file labels used see --file-modified-label, --file-removed-label, --file-added-
645 label, --file-renamed-label
646 --relative-paths Output all file paths relative to the current directory so that they resolve
647 correctly when clicked on or used in shell commands
648 --hyperlinks Render commit hashes, file names, and line numbers as hyperlinks, according to the
649 hyperlink spec for terminal emulators:
650 https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda. By default,
651 file names and line numbers link to the local file using a file URL, whereas commit
652 hashes link to the commit in GitHub, if the remote repository is hosted by GitHub.
653 See --hyperlinks-file-link-format for full control over the file URLs emitted.
654 Hyperlinks are supported by several common terminal emulators. To make them work,
655 you must use less version >= 581 with the -R flag (or use -r with older less
656 versions, but this will break e.g. --navigate). If you use tmux, then you will also
657 need a patched fork of tmux (see https://github.com/dandavison/tmux)
658 --keep-plus-minus-markers Prefix added/removed lines with a +/- character, exactly as git does. By default,
659 delta does not emit any prefix, so code can be copied directly from delta's output
660 --show-config Display the active values for all Delta options. Style options are displayed with
661 foreground and background colors. This can be used to experiment with colors by
662 combining this option with other options such as --minus-style, --zero-style,
663 --plus-style, --light, --dark, etc
664 --list-languages List supported languages and associated file extensions
665 --list-syntax-themes List available syntax-highlighting color themes
666 --show-syntax-themes Show all available syntax-highlighting themes, each with an example of highlighted
667 diff output. If diff output is supplied on standard input then this will be used
668 for the demo. For example: `git show | delta --show-syntax-themes`
669 --show-themes Show available delta themes, each with an example of highlighted diff output. A
670 delta theme is a delta named feature (see --features) that sets either `light` or
671 `dark`. See https://github.com/dandavison/delta#custom-color-themes. If diff output
672 is supplied on standard input then this will be used for the demo. For example:
673 `git show | delta --show-themes`. By default shows dark or light themes only,
674 according to whether delta is in dark or light mode (as set by the user or inferred
675 from BAT_THEME). To control the themes shown, use --dark or --light, or both, on
676 the command line together with this option
677 --no-gitconfig Do not take any settings from git config. See GIT CONFIG section
678 --raw Do not alter the input in any way. This is mainly intended for testing delta
679 --color-only Do not alter the input structurally in any way, but color and highlight hunk lines
680 according to your delta configuration. This is mainly intended for other tools that
681 use delta
682 --highlight-removed Deprecated: use --minus-style='syntax'
683 -h, --help Prints help information
684 -V, --version Prints version information
685
686OPTIONS:
687 --features <features>
688 Name of delta features to use (space-separated). A feature is a named collection of delta options in
689 ~/.gitconfig. See FEATURES section [env: DELTA_FEATURES=] [default: ]
690 --syntax-theme <syntax-theme>
691 The code syntax-highlighting theme to use. Use --show-syntax-themes to demo available themes. If the syntax-
692 highlighting theme is not set using this option, it will be taken from the BAT_THEME environment
693 variable, if that contains a valid theme name. --syntax-theme=none disables all syntax highlighting [env:
694 BAT_THEME=]
695 --minus-style <minus-style>
696 Style (foreground, background, attributes) for removed lines. See STYLES section [default: normal auto]
697 --zero-style <zero-style>
698 Style (foreground, background, attributes) for unchanged lines. See STYLES section [default: syntax normal]
699 --plus-style <plus-style>
700 Style (foreground, background, attributes) for added lines. See STYLES section [default: syntax auto]
701 --minus-emph-style <minus-emph-style>
702 Style (foreground, background, attributes) for emphasized sections of removed lines. See STYLES section
703 [default: normal auto]
704 --minus-non-emph-style <minus-non-emph-style>
705 Style (foreground, background, attributes) for non-emphasized sections of removed lines that have an
706 emphasized section. Defaults to --minus-style. See STYLES section [default: auto auto]
707 --plus-emph-style <plus-emph-style>
708 Style (foreground, background, attributes) for emphasized sections of added lines. See STYLES section
709 [default: syntax auto]
710 --plus-non-emph-style <plus-non-emph-style>
711 Style (foreground, background, attributes) for non-emphasized sections of added lines that have an
712 emphasized section. Defaults to --plus-style. See STYLES section [default: auto auto]
713 --commit-style <commit-style>
714 Style (foreground, background, attributes) for the commit hash line. See STYLES section. The style 'omit'
715 can be used to remove the commit hash line from the output [default: raw]
716 --commit-decoration-style <commit-decoration-style>
717 Style (foreground, background, attributes) for the commit hash decoration. See STYLES section. The style
718 string should contain one of the special attributes 'box', 'ul' (underline), 'ol' (overline), or the
719 combination 'ul ol' [default: ]
720 --commit-regex <commit-regex>
721 The regular expression used to identify the commit line when parsing git output [default: ^commit ]
722
723 --file-style <file-style>
724 Style (foreground, background, attributes) for the file section. See STYLES section. The style 'omit' can be
725 used to remove the file section from the output [default: blue]
726 --file-decoration-style <file-decoration-style>
727 Style (foreground, background, attributes) for the file decoration. See STYLES section. The style string
728 should contain one of the special attributes 'box', 'ul' (underline), 'ol' (overline), or the combination
729 'ul ol' [default: blue ul]
730 --hyperlinks-commit-link-format <hyperlinks-commit-link-format>
731 Format string for commit hyperlinks (requires --hyperlinks). The placeholder "{commit}" will be replaced by
732 the commit hash. For example: --hyperlinks-commit-link-format='https://mygitrepo/{commit}/'
733 --hyperlinks-file-link-format <hyperlinks-file-link-format>
734 Format string for file hyperlinks (requires --hyperlinks). The placeholders "{path}" and "{line}" will be
735 replaced by the absolute file path and the line number, respectively. The default value of this option
736 creates hyperlinks using standard file URLs; your operating system should open these in the application
737 registered for that file type. However, these do not make use of the line number. In order for the link to
738 open the file at the correct line number, you could use a custom URL format such as "file-
739 line://{path}:{line}" and register an application to handle the custom "file-line" URL scheme by
740 opening the file in your editor/IDE at the indicated line number. See https://github.com/dandavison/open-in-
741 editor for an example [default: file://{path}]
742 --hunk-header-style <hunk-header-style>
743 Style (foreground, background, attributes) for the hunk-header. See STYLES section. Special attributes
744 'file' and 'line-number' can be used to include the file path, and number of first hunk line, in the hunk
745 header. The style 'omit' can be used to remove the hunk header section from the output [default: line-
746 number syntax]
747 --hunk-header-file-style <hunk-header-file-style>
748 Style (foreground, background, attributes) for the file path part of the hunk-header. See STYLES section.
749 The file path will only be displayed if hunk-header-style contains the 'file' special attribute [default:
750 blue]
751 --hunk-header-line-number-style <hunk-header-line-number-style>
752 Style (foreground, background, attributes) for the line number part of the hunk-header. See STYLES section.
753 The line number will only be displayed if hunk-header-style contains the 'line-number' special attribute
754 [default: blue]
755 --hunk-header-decoration-style <hunk-header-decoration-style>
756 Style (foreground, background, attributes) for the hunk-header decoration. See STYLES section. The style
757 string should contain one of the special attributes 'box', 'ul' (underline), 'ol' (overline), or the
758 combination 'ul ol' [default: blue box]
759 --default-language <default-language>
760 Default language used for syntax highlighting when this cannot be inferred from a filename. It will
761 typically make sense to set this in per-repository git config (.git/config)
762 --inline-hint-style <inline-hint-style>
763 Style (foreground, background, attributes) for content added by delta to the original diff such as special
764 characters to highlight tabs, and the symbols used to indicate wrapped lines. See STYLES section [default:
765 blue]
766 --word-diff-regex <tokenization-regex>
767 The regular expression used to decide what a word is for the within-line highlight algorithm. For less fine-
768 grained matching than the default try --word-diff-regex="\S+" --max-line-distance=1.0 (this is more
769 similar to `git --word-diff`) [default: \w+]
770 --max-line-distance <max-line-distance>
771 The maximum distance between two lines for them to be inferred to be homologous. Homologous line pairs are
772 highlighted according to the deletion and insertion operations transforming one into the other [default: 0.6]
773 --line-numbers-minus-style <line-numbers-minus-style>
774 Style (foreground, background, attributes) for line numbers in the old (minus) version of the file. See
775 STYLES and LINE NUMBERS sections [default: auto]
776 --line-numbers-zero-style <line-numbers-zero-style>
777 Style (foreground, background, attributes) for line numbers in unchanged (zero) lines. See STYLES and LINE
778 NUMBERS sections [default: auto]
779 --line-numbers-plus-style <line-numbers-plus-style>
780 Style (foreground, background, attributes) for line numbers in the new (plus) version of the file. See
781 STYLES and LINE NUMBERS sections [default: auto]
782 --line-numbers-left-format <line-numbers-left-format>
783 Format string for the left column of line numbers. A typical value would be "{nm:^4}⋮" which means to
784 display the line numbers of the minus file (old version), center-aligned, padded to a width of 4 characters,
785 followed by a dividing character. See the LINE NUMBERS section [default: {nm:^4}⋮]
786 --line-numbers-right-format <line-numbers-right-format>
787 Format string for the right column of line numbers. A typical value would be "{np:^4}│ " which means to
788 display the line numbers of the plus file (new version), center-aligned, padded to a width of 4 characters,
789 followed by a dividing character, and a space. See the LINE NUMBERS section [default: {np:^4}│]
790 --line-numbers-left-style <line-numbers-left-style>
791 Style (foreground, background, attributes) for the left column of line numbers. See STYLES and LINE NUMBERS
792 sections [default: auto]
793 --line-numbers-right-style <line-numbers-right-style>
794 Style (foreground, background, attributes) for the right column of line numbers. See STYLES and LINE NUMBERS
795 sections [default: auto]
796 --wrap-max-lines <wrap-max-lines>
797 How often a line should be wrapped if it does not fit. Zero means to never wrap. Any content which does not
798 fit will be truncated. A value of "unlimited" means a line will be wrapped as many times as required
799 [default: 2]
800 --wrap-left-symbol <wrap-left-symbol>
801 Symbol added to the end of a line indicating that the content has been wrapped onto the next line and
802 continues left-aligned [default: ↵]
803 --wrap-right-symbol <wrap-right-symbol>
804 Symbol added to the end of a line indicating that the content has been wrapped onto the next line and
805 continues right-aligned [default: ↴]
806 --wrap-right-percent <wrap-right-percent>
807 Threshold for right-aligning wrapped content. If the length of the remaining wrapped content, as a
808 percentage of width, is less than this quantity it will be right-aligned. Otherwise it will be left-aligned
809 [default: 37.0]
810 --wrap-right-prefix-symbol <wrap-right-prefix-symbol>
811 Symbol displayed in front of right-aligned wrapped content [default: …]
812
813 --file-modified-label <file-modified-label>
814 Text to display in front of a modified file path [default: ]
815
816 --file-removed-label <file-removed-label>
817 Text to display in front of a removed file path [default: removed:]
818
819 --file-added-label <file-added-label>
820 Text to display in front of a added file path [default: added:]
821
822 --file-copied-label <file-copied-label>
823 Text to display in front of a copied file path [default: copied:]
824
825 --file-renamed-label <file-renamed-label>
826 Text to display in front of a renamed file path [default: renamed:]
827
828 --hunk-label <hunk-label>
829 Text to display in front of a hunk header [default: ]
830
831 --max-line-length <max-line-length>
832 Truncate lines longer than this. To prevent any truncation, set to zero. Note that delta will be slow on
833 very long lines (e.g. minified .js) if truncation is disabled. When wrapping lines it is automatically set
834 to fit at least all visible characters [default: 512]
835 --line-fill-method <line-fill-method>
836 How to extend the background color to the end of the line in side-by-side mode. Can be ansi (default) or
837 spaces (default if output is not to a terminal). Has no effect if --width=variable is given
838 -w, --width <width>
839 The width of underline/overline decorations. Examples: "72" (exactly 72 characters), Use --width=variable to
840 extend decorations and background colors to the end of the text only. Otherwise background colors extend to
841 the full terminal width
842 --diff-stat-align-width <diff-stat-align-width>
843 Width allocated for file paths in a diff stat section. If a relativized file path exceeds this width then
844 the diff stat will be misaligned [default: 48]
845 --tabs <tab-width>
846 The number of spaces to replace tab characters with. Use --tabs=0 to pass tab characters through directly,
847 but note that in that case delta will calculate line widths assuming tabs occupy one character's width on
848 the screen: if your terminal renders tabs as more than than one character wide then delta's output will look
849 incorrect [default: 4]
850 --true-color <true-color>
851 Whether to emit 24-bit ("true color") RGB color codes. Options are auto, always, and never. "auto" means
852 that delta will emit 24-bit color codes if the environment variable COLORTERM has the value "truecolor" or
853 "24bit". If your terminal application (the application you use to enter commands at a shell prompt) supports
854 24 bit colors, then it probably already sets this environment variable, in which case you don't need to do
855 anything [default: auto]
856 --24-bit-color <24-bit-color> Deprecated: use --true-color
857 --inspect-raw-lines <inspect-raw-lines>
858 Whether to examine ANSI color escape sequences in raw lines received from Git and handle lines colored in
859 certain ways specially. This is on by default: it is how Delta supports Git's --color-moved feature. Set
860 this to "false" to disable this behavior [default: true]
861 --pager <pager>
862 Which pager to use. The default pager is `less`. You can also change pager by setting the environment
863 variables DELTA_PAGER, BAT_PAGER, or PAGER (and that is their order of priority). This option overrides all
864 environment variables above
865 --paging <paging-mode>
866 Whether to use a pager when displaying output. Options are: auto, always, and never [default: auto]
867 --minus-empty-line-marker-style <minus-empty-line-marker-style>
868 Style for removed empty line marker (used only if --minus-style has no background color) [default: normal auto]
869 --plus-empty-line-marker-style <plus-empty-line-marker-style>
870 Style for added empty line marker (used only if --plus-style has no background color) [default: normal auto]
871 --whitespace-error-style <whitespace-error-style>
872 Style for whitespace errors. Defaults to color.diff.whitespace if that is set in git config, or else
873 'magenta reverse' [default: auto auto]
874 --line-buffer-size <line-buffer-size>
875 Size of internal line buffer. Delta compares the added and removed versions of nearby lines in order to
876 detect and highlight changes at the level of individual words/tokens. Therefore, nearby lines must be
877 buffered internally before they are painted and emitted. Increasing this value might improve highlighting of
878 some large diff hunks. However, setting this to a high value will adversely affect delta's performance when
879 entire files are added/removed [default: 32]
880 --minus-color <deprecated-minus-background-color>
881 Deprecated: use --minus-style='normal my_background_color'
882
883 --minus-emph-color <deprecated-minus-emph-background-color>
884 Deprecated: use --minus-emph-style='normal my_background_color'
885
886 --plus-color <deprecated-plus-background-color>
887 Deprecated: Use --plus-style='syntax my_background_color' to change the background color while retaining
888 syntax-highlighting
889 --plus-emph-color <deprecated-plus-emph-background-color>
890 Deprecated: Use --plus-emph-style='syntax my_background_color' to change the background color while
891 retaining syntax-highlighting
892 --commit-color <deprecated-commit-color>
893 Deprecated: use --commit-style='my_foreground_color' --commit-decoration-style='my_foreground_color'
894
895 --file-color <deprecated-file-color>
896 Deprecated: use --file-style='my_foreground_color' --file-decoration-style='my_foreground_color'
897
898 --hunk-style <deprecated-hunk-style>
899 Deprecated: synonym of --hunk-header-decoration-style
900
901 --hunk-color <deprecated-hunk-color>
902 Deprecated: use --hunk-header-style='my_foreground_color' --hunk-header-decoration-
903 style='my_foreground_color'
904 --theme <deprecated-theme> Deprecated: use --syntax-theme
905
906ARGS:
907 <minus-file> First file to be compared when delta is being used in diff mode: `delta file_1 file_2` is
908 equivalent to `diff -u file_1 file_2 | delta`
909 <plus-file> Second file to be compared when delta is being used in diff mode
910
911GIT CONFIG
912----------
913
914By default, delta takes settings from a section named "delta" in git config files, if one is
915present. The git config file to use for delta options will usually be ~/.gitconfig, but delta
916follows the rules given in https://git-scm.com/docs/git-config#FILES. Most delta options can be
917given in a git config file, using the usual option names but without the initial '--'. An example
918is
919
920[delta]
921 line-numbers = true
922 zero-style = dim syntax
923
924FEATURES
925--------
926A feature is a named collection of delta options in git config. An example is:
927
928[delta "my-delta-feature"]
929 syntax-theme = Dracula
930 plus-style = bold syntax "#002800"
931
932To activate those options, you would use:
933
934delta --features my-delta-feature
935
936A feature name may not contain whitespace. You can activate multiple features:
937
938[delta]
939 features = my-highlight-styles-colors-feature my-line-number-styles-feature
940
941If more than one feature sets the same option, the last one wins.
942
943STYLES
944------
945
946All options that have a name like --*-style work the same way. It is very similar to how
947colors/styles are specified in a gitconfig file:
948https://git-scm.com/docs/git-config#Documentation/git-config.txt-color
949
950Here is an example:
951
952--minus-style 'red bold ul "#ffeeee"'
953
954That means: For removed lines, set the foreground (text) color to 'red', make it bold and
955 underlined, and set the background color to '#ffeeee'.
956
957See the COLORS section below for how to specify a color. In addition to real colors, there are 4
958special color names: 'auto', 'normal', 'raw', and 'syntax'.
959
960Here is an example of using special color names together with a single attribute:
961
962--minus-style 'syntax bold auto'
963
964That means: For removed lines, syntax-highlight the text, and make it bold, and do whatever delta
965 normally does for the background.
966
967The available attributes are: 'blink', 'bold', 'dim', 'hidden', 'italic', 'reverse', 'strike',
968and 'ul' (or 'underline').
969
970The attribute 'omit' is supported by commit-style, file-style, and hunk-header-style, meaning to
971remove the element entirely from the output.
972
973A complete description of the style string syntax follows:
974
975- If the input that delta is receiving already has colors, and you want delta to output those
976 colors unchanged, then use the special style string 'raw'. Otherwise, delta will strip any colors
977 from its input.
978
979- A style string consists of 0, 1, or 2 colors, together with an arbitrary number of style
980 attributes, all separated by spaces.
981
982- The first color is the foreground (text) color. The second color is the background color.
983 Attributes can go in any position.
984
985- This means that in order to specify a background color you must also specify a foreground (text)
986 color.
987
988- If you want delta to choose one of the colors automatically, then use the special color 'auto'.
989 This can be used for both foreground and background.
990
991- If you want the foreground/background color to be your terminal's foreground/background color,
992 then use the special color 'normal'.
993
994- If you want the foreground text to be syntax-highlighted according to its language, then use the
995 special foreground color 'syntax'. This can only be used for the foreground (text).
996
997- The minimal style specification is the empty string ''. This means: do not apply any colors or
998 styling to the element in question.
999
1000COLORS
1001------
1002
1003There are three ways to specify a color (this section applies to foreground and background colors
1004within a style string):
1005
10061. RGB hex code
1007
1008 An example of using an RGB hex code is:
1009 --file-style="#0e7c0e"
1010
10112. ANSI color name
1012
1013 There are 8 ANSI color names:
1014 black, red, green, yellow, blue, magenta, cyan, white.
1015
1016 In addition, all of them have a bright form:
1017 brightblack, brightred, brightgreen, brightyellow, brightblue, brightmagenta, brightcyan, brightwhite.
1018
1019 An example of using an ANSI color name is:
1020 --file-style="green"
1021
1022 Unlike RGB hex codes, ANSI color names are just names: you can choose the exact color that each
1023 name corresponds to in the settings of your terminal application (the application you use to
1024 enter commands at a shell prompt). This means that if you use ANSI color names, and you change
1025 the color theme used by your terminal, then delta's colors will respond automatically, without
1026 needing to change the delta command line.
1027
1028 "purple" is accepted as a synonym for "magenta". Color names and codes are case-insensitive.
1029
10303. ANSI color number
1031
1032 An example of using an ANSI color number is:
1033 --file-style=28
1034
1035 There are 256 ANSI color numbers: 0-255. The first 16 are the same as the colors described in
1036 the "ANSI color name" section above. See https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit.
1037 Specifying colors like this is useful if your terminal only supports 256 colors (i.e. doesn't
1038 support 24-bit color).
1039
1040
1041LINE NUMBERS
1042------------
1043
1044To display line numbers, use --line-numbers.
1045
1046Line numbers are displayed in two columns. Here's what it looks like by default:
1047
1048 1 ⋮ 1 │ unchanged line
1049 2 ⋮ │ removed line
1050 ⋮ 2 │ added line
1051
1052In that output, the line numbers for the old (minus) version of the file appear in the left column,
1053and the line numbers for the new (plus) version of the file appear in the right column. In an
1054unchanged (zero) line, both columns contain a line number.
1055
1056The following options allow the line number display to be customized:
1057
1058--line-numbers-left-format: Change the contents of the left column
1059--line-numbers-right-format: Change the contents of the right column
1060--line-numbers-left-style: Change the style applied to the left column
1061--line-numbers-right-style: Change the style applied to the right column
1062--line-numbers-minus-style: Change the style applied to line numbers in minus lines
1063--line-numbers-zero-style: Change the style applied to line numbers in unchanged lines
1064--line-numbers-plus-style: Change the style applied to line numbers in plus lines
1065
1066Options --line-numbers-left-format and --line-numbers-right-format allow you to change the contents
1067of the line number columns. Their values are arbitrary format strings, which are allowed to contain
1068the placeholders {nm} for the line number associated with the old version of the file and {np} for
1069the line number associated with the new version of the file. The placeholders support a subset of
1070the string formatting syntax documented here: https://doc.rust-lang.org/std/fmt/#formatting-parameters.
1071Specifically, you can use the alignment and width syntax.
1072
1073For example, the default value of --line-numbers-left-format is '{nm:^4}⋮'. This means that the
1074left column should display the minus line number (nm), center-aligned, padded with spaces to a
1075width of 4 characters, followed by a unicode dividing-line character (⋮).
1076
1077Similarly, the default value of --line-numbers-right-format is '{np:^4}│'. This means that the
1078right column should display the plus line number (np), center-aligned, padded with spaces to a
1079width of 4 characters, followed by a unicode dividing-line character (│).
1080
1081Use '<' for left-align, '^' for center-align, and '>' for right-align.
1082
1083
1084If something isn't working correctly, or you have a feature request, please open an issue at
1085https://github.com/dandavison/delta/issues.
1086```
1087
1088## Delta configs used in screenshots
1089
1090### Side-by-side view
1091
1092https://github.com/vuejs/vue/commit/7ec4627902020cccd7b3f4fbc63e1b0d6b9798cd
1093
1094```gitconfig
1095[delta]
1096 features = side-by-side line-numbers decorations
1097 syntax-theme = Dracula
1098 plus-style = syntax "#003800"
1099 minus-style = syntax "#3f0001"
1100
1101[delta "decorations"]
1102 commit-decoration-style = bold yellow box ul
1103 file-style = bold yellow ul
1104 file-decoration-style = none
1105 hunk-header-decoration-style = cyan box ul
1106
1107[delta "line-numbers"]
1108 line-numbers-left-style = cyan
1109 line-numbers-right-style = cyan
1110 line-numbers-minus-style = 124
1111 line-numbers-plus-style = 28
1112```
1113