5 ms·
Well-written article! I wish there was some kind of standard to tell CLI apps what features to expect from the system pager, so they can act accordingly … Rig
by da_rob 6mo ago
Well-written article!
I wish there was some kind of standard to tell CLI apps what features to expect from the system pager, so they can act accordingly …
Right now, apps can talk to the terminal to check for feature support, but all of that falls apart when the output is piped to a pager. (Do we support inline links? ANSI colors? Sixel support??)
Shameless plug, specifically regarding Sixel support: I needed a pager with better image support than just less -r and made https://github.com/roblillack/lessi https://github.com/roblillack/lessi
- Cthulhu_ 6mo agoTo be pedantic, you mean a standard like IEEE 1003 aka POSIX? (https://pubs.opengroup.org/onlinepubs/9799919799/utilities/more.html https://pubs.opengroup.org/onlinepubs/9799919799/utilities/m...)
- xk3 6mo agomaybe just check TERM? although to be honest--do you even need a pager if your shell/terminal is nice enough? I rarely pipe to a pager because kitty/fish/tmux support OSC 133 pretty well and I can press one button to go up to the previous command prompt and another button to go back. I can press a few keys to search the scrollback. It all works seamlessly across SSH sessions too if you set it up right. # tmux bind-key -T copy-mode C-Home send -X history-top bind-key -T copy-mode C-End send -X history-bottom bind -T copy-mode C-Up send-keys -X previous-prompt bind -T copy-mode C-Down send-keys -X next-prompt # kitty map ctrl+up scroll_to_prompt -1 map ctrl+down scroll_to_prompt 1 map shift+PAGE_UP scroll_page_up map shift+PAGE_DOWN scroll_page_down # fish shell config.fish if test -z "$SSH_TTY"; and test -z "$TMUX" bind pageup "kitty @ scroll-window 1p-" bind pagedown "kitty @ scroll-window 1p" end