summaryrefslogtreecommitdiff
path: root/manual/src/configuration.md
blob: a71186c987f4b2d78eea5408a2d20aa4190dc542 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Configuration

## Git config file

Delta uses [git config](https://git-scm.com/docs/git-config#_configuration_file) (`~/.gitconfig`) for its configuration. Here's an example:

<sub>

```gitconfig
[core]
    pager = delta

[interactive]
    diffFilter = delta --color-only

[delta]
    navigate = true  # use n and N to move between diff sections
    dark = true      # or light = true, or omit for auto-detection

[merge]
    conflictstyle = zdiff3
```

You do not even need to use git -- delta accepts `git diff` and unified diff formats and hence works with e.g. mercurial and jujutsu -- but you do need to use the git config format.

If you want to store your delta config at a different location, use [[git docs](https://git-scm.com/docs/git-config#Documentation/git-config.txt-GITCONFIGGLOBAL)]
```bash
export GIT_CONFIG_GLOBAL=/path/to/my/delta/config
```

If you want to keep your delta and git config separate, use [[git docs](https://git-scm.com/docs/git-config#_includes)]
```gitconfig
[include]
    path = ~/src/devenv/dotfiles/delta/delta.gitconfig
```


</sub>

Use `delta --help` to see all the available options.

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`

To change your delta options in a one-off git command, use `git -c`. For example

```sh
git -c delta.line-numbers=false show
```

There are several important environment variables that affect delta configuration and which can be used to configure delta dynamically.
Please see [Environment variables](./environment-variables.md).