git/list[1] front-page[2] threads[3] people[4] search[5] about
 

pager: consider revisiting automatic LESS=FRX with custom core.pager

From
FBFrancisco Boni <boboniboni@gmail.com>
Date
Sep 19, 2026, 12:19 UTC
Message-ID
<CAKNeS+mFS_VCs_tQeFb8jBx70FwQLW0LtuqhSk4xSdbWdqDR=g@mail.gmail.com>
Hi,

I ran into a surprising interaction between Git's pager environment handling and a custom pager, and I think the longstanding automatic `LESS=FRX` behavior may be worth revisiting.

My setup is roughly:
```
[core]
    pager = delta
```
with delta eventually invoking `less`.
In my shell I had:

``` export PAGER="less" ```

but deliberately did not set `LESS`.
I also configured delta's pager explicitly as:

``` less --RAW-CONTROL-CHARS --quit-if-one-screen --quit-on-intr --ignore-case ```

What surprised me was that:

``` git diff <commit1> <commit2> ```

caused the downstream `less` process to behave as though `-X` / `--no-init` had been specified: it did not use the alternate screen, and in my terminal Page Up / Page Down also stopped behaving normally.

The `less` argv itself looked as expected and did not contain `-X`.
Eventually I tracked this down to Git setting:

``` LESS=FRX ```

when `LESS` is absent from the environment.
The particularly revealing test was:

``` LESS="" git diff <commit1> <commit2> ```

With that single change, the same delta -> less chain used the alternate screen normally and Page Up / Page Down worked again.

I understand that Git's default `LESS=FRX` behavior is old, documented, and presumably exists to provide useful defaults when Git directly invokes `less`.

What seems questionable to me is that it is also applied when `core.pager` is an arbitrary custom command.

In this case the effective chain is:

``` git -> delta -> less ```

Git is not invoking `less` itself, but the `LESS=FRX` value injected by Git is inherited by delta and then by the `less` process launched by delta. As a result, Git ends up silently configuring an implementation detail of a pager wrapper. A user who explicitly configures:

``` core.pager = delta ```

would not necessarily expect Git to alter environment variables specific to another pager that delta may or may not use internally.

There is also an unintuitive distinction between:

``` unset LESS ```

and:

``` LESS="" ```

The former causes Git to inject `FRX`, while the latter causes Git to leave the pager environment alone.

I realize simply removing the default could have substantial compatibility consequences given how longstanding this behavior is. But perhaps it would be worth considering whether the automatic `LESS` default should:

* apply only to Git's own default pager path;
* be suppressible explicitly through configuration; or
* otherwise avoid affecting arbitrary custom `core.pager` commands.
For my own setup, explicitly setting:

``` export LESS="--RAW-CONTROL-CHARS --quit-if-one-screen --quit-on-intr --ignore-case" ```

solves the issue cleanly, because Git then leaves `LESS` untouched.

So this is not primarily a request for a workaround; rather, I wanted to raise the broader behavior because the interaction with pager wrappers is quite surprising and difficult to diagnose.

Thanks, Francisco Boni

Next: brian m. carlson
Message 1 of 7 in “pager: consider revisiting automatic LESS=FRX with custom core.pager”
  1. Francisco BoniSep 19, 2026
  2. brian m. carlsonSep 19, 2026
  3. Todd ZullingerSep 19, 2026
  4. doc: add more examples of overriding LESS in core.pagerTodd Zullinger, Oct 2, 2026
  5. brian m. carlsonOct 5, 2026
  6. Junio C HamanoOct 6, 2026
  7. Francisco BoniSep 19, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.