diff --git a/README.md b/README.md index a9cc97b6..254d070d 100644 --- a/README.md +++ b/README.md @@ -635,9 +635,11 @@ syntax, use (this mapping is already built in): ### Using a different pager `bat` uses the pager that is specified in the `PAGER` environment variable. If this variable is not -set, `less` is used by default. If you want to use a different pager, you can either modify the -`PAGER` variable or set the `BAT_PAGER` environment variable to override what is specified in -`PAGER`. +set, `less` is used by default. You can also use bat's built-in pager with `--pager=builtin` or +by setting the `BAT_PAGER` environment variable to "builtin". + +If you want to use a different pager, you can either modify the `PAGER` variable or set the +`BAT_PAGER` environment variable to override what is specified in `PAGER`. >[!NOTE] > If `PAGER` is `more` or `most`, `bat` will silently use `less` instead to ensure support for colors. diff --git a/assets/completions/bat.fish.in b/assets/completions/bat.fish.in index e2712706..29979e8b 100644 --- a/assets/completions/bat.fish.in +++ b/assets/completions/bat.fish.in @@ -106,6 +106,7 @@ set -l pager_opts ' less\ -FR\t more\t vimpager\t + builtin\t ' set -l italic_text_opts ' diff --git a/assets/manual/bat.1.in b/assets/manual/bat.1.in index 86923db7..faa69d53 100644 --- a/assets/manual/bat.1.in +++ b/assets/manual/bat.1.in @@ -149,8 +149,9 @@ which pager is used, see the '\-\-pager' option. Possible values: *auto*, never, \fB\-\-pager\fR .IP Determine which pager is used. This option will override the PAGER and BAT_PAGER -environment variables. The default pager is 'less'. To control when the pager is used, see -the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'. +environment variables. The default pager is 'less'. If you provide '\-\-pager=builtin', use +the built-in 'minus' pager. To control when the pager is used, see the '\-\-paging' option. +Example: '\-\-pager "less \fB\-RF\fR"'. Note: By default, if the pager is set to 'less' (and no command-line options are specified), 'bat' will pass the following command line options to the pager: '-R'/'--RAW-CONTROL-CHARS', '-F'/'--quit-if-one-screen' and '-X'/'--no-init'. The last option ('-X') is only used for 'less' versions older than 530. The '-R' option is needed to interpret ANSI colors correctly. The second option ('-F') instructs less to exit immediately if the output size is smaller than the vertical size of the terminal. This is convenient for small files because you do not have to press 'q' to quit the pager. The third option ('-X') is needed to fix a bug with the '--quit-if-one-screen' feature in old versions of 'less'. Unfortunately, it also breaks mouse-wheel support in 'less'. If you want to enable mouse-wheel scrolling on older versions of 'less', you can pass just '-R' (as in the example above, this will disable the quit-if-one-screen feature). For less 530 or newer, it should work out of the box. .HP diff --git a/doc/long-help.txt b/doc/long-help.txt index 231b711e..ac5ded9e 100644 --- a/doc/long-help.txt +++ b/doc/long-help.txt @@ -95,14 +95,15 @@ Options: piped to another program, but you want to keep the colorization/decorations. --paging - Specify when to use the pager. To disable the pager, use --paging=never' or its + Specify when to use the pager. To disable the pager, use '--paging=never' or its alias,'-P'. To disable the pager permanently, set BAT_PAGING to 'never'. To control which pager is used, see the '--pager' option. Possible values: *auto*, never, always. --pager Determine which pager is used. This option will override the PAGER and BAT_PAGER - environment variables. The default pager is 'less'. To control when the pager is used, see - the '--paging' option. Example: '--pager "less -RF"'. + environment variables. The default pager is 'less'. If you provide '--pager=builtin', use + the built-in 'minus' pager. To control when the pager is used, see the '--paging' option. + Example: '--pager "less -RF"'. -m, --map-syntax Map a glob pattern to an existing syntax name. The glob pattern is matched on the full diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index 7aa1ef20..f7e86dbc 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -328,7 +328,7 @@ pub fn build_app(interactive_output: bool) -> Command { .help("Specify when to use the pager, or use `-P` to disable (*auto*, never, always).") .long_help( "Specify when to use the pager. To disable the pager, use \ - --paging=never' or its alias,'-P'. To disable the pager permanently, \ + '--paging=never' or its alias,'-P'. To disable the pager permanently, \ set BAT_PAGING to 'never'. To control which pager is used, see the \ '--pager' option. Possible values: *auto*, never, always." ), @@ -354,6 +354,7 @@ pub fn build_app(interactive_output: bool) -> Command { .long_help( "Determine which pager is used. This option will override the \ PAGER and BAT_PAGER environment variables. The default pager is 'less'. \ + If you provide '--pager=builtin', use the built-in 'minus' pager. \ To control when the pager is used, see the '--paging' option. \ Example: '--pager \"less -RF\"'." ),