Skip to content

The Pager

fs includes a pager which wraps bat when present, feeding it into a fork of minus. This pager includes a few modifications required by fs for a smooth experience: it skips starting on empty (non-file) inputs, writes to /dev/tty in fist (so that fs can still write to stdout), and reads environment variables to propogate options such as bat arguments so that it fits as a configurable $PAGER in scripts (if so desired) with maximal compatibility.

When output gets paged

  • Actions: ExecPaged andLfPaged run the command with its stdout streamed into an interactive minus pager drawn on /dev/tty. Quitting the pager (q) kills the command and returns to the TUI.
  • Lessfilter: The preview, display and extract presets render a compatible files' content into the preview pane.
  • fs :tool pager: Behaves similarly to standard pagers, but provides syntax highlighting through bat, and reads options through environment variables.

Configuration — pager.toml

toml
bat_opts = ["--color=always", "--style=changes"]
line_numbers = false
follow = false
horizontal_scroll = false
smart_case = false
# prompt = "" # disable prompt text
FieldTypeMeaning
bat_optslist of stringsExtra arguments passed to bat.
line_numbersboolShow line numbers in the pager.
followboolAuto-scroll as new output arrives (follow mode).
horizontal_scrollboolAlways enable horizontal scrolling (Ctrl+h still toggles it).
promptstringFooter prompt text shown by the pager.
smart_caseboolQueries with no uppercase chars match case-insensitively; queries with uppercase stay case-sensitive.

bat is only used when the bat binary is on PATH; without it, output passes through uncolored.

fs :tool pager (alias pg)

Page one file, or stdin when no file is given:

sh
fs :tool pager Cargo.toml
cat Cargo.toml | fs :tool pager
fs :tool pager -- Cargo.toml
  • Bat arguments come from the environment (see below) — the same options the lessfilter renderer honors.
  • Empty non-file input produces skips the pager and exits 0.
  • On a terminal, output is paged interactively (minus), with bat colors when bat is installed. When stdout is a pipe or file, content passes through with colors but no paging UI.

Environment variables

These apply to fs :tool pager and every paged lessfilter output (preview, display, extract):

VariableEffect
PG_RAW=trueSkip bat entirely; pass the raw stream through.
PG_FLAGSComma-separated bat flags that replace the default argument set (a doubled ,, escapes a literal comma).
PG_LANGBat language override: -l <value> (e.g. PG_LANG=ini).
PG_FILENAMEBat file name hint: --file-name <value> (used for language detection on stdin input).
HIGHLIGHT_LINENumber: bat --highlight-line <value>.

minus keybindings

These are the defaults of minus 5.7. A keybinding table for all of minus's actions lives in the minus documentation.

KeyAction
q, Ctrl-cQuit the pager (always resumes the picker)
j / , k / Scroll one line (prefix a number to repeat)
Space, PageDown / PageUpScroll one page
u, Ctrl-u / d, Ctrl-dScroll half a page
g / GGo to the top / bottom (or to line N)
EnterScroll N lines
h / , l / Scroll horizontally
Ctrl-lToggle line numbers
Ctrl-fToggle follow mode
Ctrl + HToggle line wrap
/, ?Search forward / backward
n, pJump to the next / previous match