Skip to content

don't reset LESS #538

Closed
Closed

Description

@danielwerg

enter) echo -n "${FORGIT_ENTER_PAGER:-"LESS='-r' less"}" ;;

this line rewrote my LESS env.

workaround:

export FORGIT_ENTER_PAGER="LESS=\"$LESS\" less"

also there is no docs on FORGIT_ENTER_PAGER.

Activity

  1. carlfriedrich commented on Jun 14, 2026

    @carlfriedrich
    Collaborator

    Thanks for your report. Actually that's exactly the use case for FORGIT_ENTER_PAGER.
    I'm not sure we should respect the user's LESS env by default, as this could break the intended forgit user experience.
    We should document the variable, though.
    @wfxr @sandr01d @cjappl WDYT?

  2. danielwerg commented on Jun 14, 2026

    @danielwerg
    Author

    I think big red note about setting LESS is ought to be in docs as well.

  3. sandr01d commented on Jun 16, 2026

    @sandr01d
    Collaborator

    I agree with you @carlfriedrich, overriding $LESS by default to prevent breakage makes sense to me and of course $FORGIT_ENTER_PAGER should be documented.

  4. wfxr commented on Aug 12, 2026

    @wfxr
    Owner

    I looked further into the history, and the LESS override was originally introduced in b27df40 specifically to prevent -F from making the Enter pager exit immediately for short output. So changing the default to less -R would not be behavior-neutral: -R is sufficient for ANSI color pass-through, but inherited options such as -F, -E, -X, and -S can still change the full-screen behavior.

    Git preserves an existing LESS, but it also uses command-line options such as less -+F for selective overrides. If we want to follow that model, we should first define which Enter-pager behavior forgit needs to guarantee and override those options explicitly. Otherwise, resetting LESS is intentional and should be documented.

    Either way, using -R rather than -r and documenting FORGIT_ENTER_PAGER seem worthwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions