Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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

 help



maybe 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

To be pedantic, you mean a standard like IEEE 1003 aka POSIX? (https://pubs.opengroup.org/onlinepubs/9799919799/utilities/m...)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: