| 1 | # Configuration |
| 2 | |
| 3 | ## Git config file |
| 4 | |
| 5 | Delta uses [git config](https://git-scm.com/docs/git-config#_configuration_file) (`~/.gitconfig`) for its configuration. Here's an example: |
| 6 | |
| 7 | <sub> |
| 8 | |
| 9 | ```gitconfig |
| 10 | [core] |
| 11 | pager = delta |
| 12 | |
| 13 | [interactive] |
| 14 | diffFilter = delta --color-only |
| 15 | |
| 16 | [delta] |
| 17 | navigate = true # use n and N to move between diff sections |
| 18 | dark = true # or light = true, or omit for auto-detection |
| 19 | |
| 20 | [merge] |
| 21 | conflictStyle = zdiff3 |
| 22 | ``` |
| 23 | |
| 24 | 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. |
| 25 | |
| 26 | 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)] |
| 27 | ```bash |
| 28 | export GIT_CONFIG_GLOBAL=/path/to/my/delta/config |
| 29 | ``` |
| 30 | |
| 31 | If you want to keep your delta and git config separate, use [[git docs](https://git-scm.com/docs/git-config#_includes)] |
| 32 | ```gitconfig |
| 33 | [include] |
| 34 | path = ~/src/devenv/dotfiles/delta/delta.gitconfig |
| 35 | ``` |
| 36 | |
| 37 | |
| 38 | </sub> |
| 39 | |
| 40 | Use `delta --help` to see all the available options. |
| 41 | |
| 42 | 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`. |
| 43 | |
| 44 | All git commands that display diff output should now display syntax-highlighted output. For example: |
| 45 | |
| 46 | - `git diff` |
| 47 | - `git show` |
| 48 | - `git log -p` |
| 49 | - `git stash show -p` |
| 50 | - `git reflog -p` |
| 51 | - `git add -p` |
| 52 | |
| 53 | To change your delta options in a one-off git command, use `git -c`. For example |
| 54 | |
| 55 | ```sh |
| 56 | git -c delta.line-numbers=false show |
| 57 | ``` |
| 58 | |
| 59 | There are several important environment variables that affect delta configuration and which can be used to configure delta dynamically. |
| 60 | Please see [Environment variables](./environment-variables.md). |
| 61 | |
| 62 | ## Jujutsu |
| 63 | |
| 64 | For [Jujutsu](https://github.com/jj-vcs/jj) users, add this to your `~/.config/jj/config.toml`: |
| 65 | |
| 66 | ```toml |
| 67 | [ui] |
| 68 | pager = "delta" |
| 69 | diff-formatter = ":git" |
| 70 | ``` |