summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKriss <kr1ss.x@yandex.com>2020-11-06 22:12:34 +0100
committerGitHub <noreply@github.com>2020-11-06 16:12:34 -0500
commit19aa3bd16ec266ed2f0afa4ec7ee3cf5ec457804 (patch)
tree96de14f8c951f228d108164da5e21f4e8e9ab9ae
parent3dac4f7fa6451c446902583d2d2aa1358960fe7c (diff)
Document configuration via environment (#379)
* [README,help] add warning : possible call cycle As described in the discussion of #378, certain constellations of envi- ronment variable configuration may lead to an endless recursion cycle. This adds a note to `README.md`, and to the application's help output, to make users aware of that. * Revert "[README,help] add warning : possible call cycle" This reverts commit d83e9414b7d247b14a5a2f89e04cdd9e9c60c848. * Add a section about env vars to `README.md` This splits up the "Configuration" paragraph into two sections. Basi- cally, the current paragraph becomes the first of these sections, while a description of the relevant environment variables is added as the se- cond section. The additional text briefly mentions the issue of possible call cycle situations, to make users aware. * Add hyperlinks to the ToC * Remove warning note * Link to online man pages We cannot presuppose that every user has local man pages installed and is familiar with using them. * Fix a typo https://github.com/dandavison/delta/pull/379#discussion_r518402367 * Rephrase https://github.com/dandavison/delta/pull/379#discussion_r518403353
-rw-r--r--README.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4d899a16..31fd8284 100644
--- a/README.md
+++ b/README.md
@@ -72,6 +72,8 @@ Contents
* [Installation](#installation)
* [Configuration](#configuration)
+ * [Git config files](#git-config-files)
+ * [Environment](#environment)
* [Usage](#usage)
* [Choosing colors (styles)](#choosing-colors-styles)
* [Line numbers](#line-numbers)
@@ -261,6 +263,9 @@ Behind the scenes, delta uses `less` for paging. The version of `less` that come
## 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. An example is
```gitconfig
[core]
@@ -294,6 +299,25 @@ 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