diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8ff9d8661..d4e3a7b5a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -25,6 +25,7 @@ Interactive improvements - The history pager now uses more screen space, usually half the screen (:issue:`9458`) - Variables that were set while the locale was C (i.e. ASCII) will now properly be encoded if the locale is switched (:issue:`2613`, :issue:`9473`). - Escape during history search restores the original commandline again (regressed in 3.6.0). +- Using ``--help`` on builtins now respects the $MANPAGER variable in preference to $PAGER (:issue:`9488`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/share/functions/__fish_print_help.fish b/share/functions/__fish_print_help.fish index a988ded2b..d65d3c946 100644 --- a/share/functions/__fish_print_help.fish +++ b/share/functions/__fish_print_help.fish @@ -126,8 +126,12 @@ function __fish_print_help --description "Print help message for the specified f end | string replace -ra '^ ' '' | begin set -l pager less + # Try both PAGER and MANPAGER, last one wins set -q PAGER - and echo $PAGER | read -at pager + and echo -- $PAGER | read -at pager + set -q MANPAGER + and echo -- $MANPAGER | read -at pager + not isatty stdout and set pager cat # cannot use a builtin here # similar to man, but add -F to quit paging when the help output is brief (#6227)