|
I'd like to use What are the recommended pagers and how do I configure them? |
Replies: 1 comment
Using hl with an interactive pager
Step 1 — Set candidate priorityEdit For example, to prefer [pager]
candidates = [
# Application-specific env vars still take top priority.
{ env = { pager = "HL_PAGER", follow = "HL_FOLLOW_PAGER", delimiter = "HL_PAGER_DELIMITER" }, profiles = true },
# Your preferred profiles, in order.
{ profile = "fzf", if = "!os:windows" },
{ profile = "ov" },
{ profile = "less" },
# Generic PAGER comes last to avoid surprises.
{ env = "PAGER" },
]If none of the listed pagers are installed, Example: fzf — fuzzy filtering, multi-select, clipboard yank
Just install fzf and make sure the # View mode — filter and browse interactively
hl app.log
# Follow mode — live tail with filtering
hl --follow app.logUseful keybindings (built-in defaults):
To customise the fzf profile, override it in your config: [[pager.profiles]]
name = "fzf"
command = "fzf"
delimiter = "newline"
args = [
"--ansi",
"--exact",
"--multi",
"--no-sort",
"--no-bold",
"--highlight-line",
"--bind=ctrl-q:abort",
"--bind=enter:toggle-raw",
]
conditions = [
{ if = "os:macos", args = ["--bind=ctrl-y:execute-silent(printf %s\\\\n {+} | pbcopy)"] },
{ if = "os:linux", args = ["--bind=ctrl-y:execute-silent(printf %s\\\\n {+} | xclip -in -sel clip)"] },
{ if = "!mode:follow", args = ["--layout=reverse-list"] },
{ if = "mode:follow", args = ["--tac", "--track", "--tail=100000"] },
]
modes.follow.enabled = trueExample: ov — section-aware viewer with follow modeov is a terminal pager that supports horizontal scrolling, follow mode, and section-based navigation. The built-in profile: [[pager.profiles]]
name = "ov"
command = "ov"
args = ["--caption=>", "--wrap=false", "--hscroll-width=4"]
modes.follow.args = ["--follow-mode"]
modes.follow.enabled = true
Example: less — simple scrollback with searchThe built-in [[pager.profiles]]
name = "less"
command = "less"
args = ["-R", "--mouse"]
env = { LESSCHARSET = "UTF-8" }
modes.follow.enabled = false
If you want additional flags like [[pager.profiles]]
name = "less"
command = "less"
args = ["-R", "-S", "--mouse"]
env = { LESSCHARSET = "UTF-8" }
modes.follow.enabled = falseQuick override without editing configUse the # Use the fzf profile for this invocation
HL_PAGER=@fzf hl app.log
# Use the ov profile
HL_PAGER=@ov hl app.log
# Use a custom command directly
HL_PAGER="less -RS" hl app.log
# Disable paging entirely
hl -P app.logSummary of candidate resolution order
|
Using hl with an interactive pager
hlhas a built-in pager profile system that tries candidates in order until one is found. The first thing to do is arrange the candidate list so your preferred pager is tried first and generic environment variables likePAGERdon't override your choice.Step 1 — Set candidate priority
Edit
~/.config/hl/config.toml(Linux/macOS) and override the[pager]section. The key idea: put your preferred profile right after theHL_PAGERentry and before the{ env = "PAGER" }entry so that a shell-widePAGER=lessdoesn't silently win.For example, to prefer
fzf, then fall back toov, thenless: