Live data from Hacker News

I made a terminal pager

theleo.zone

41–50 of 51 posts

Re: I made a terminal pager

#41

Earlier quoted context omitted.

bat does not look like a pager: https://github.com/sharkdp/bat?tab=readme-ov-file#automatic-...

In fact it's not. The name itself mimicks cat, not less. It's a filter that adds annotations to its input, such as syntax highlighting, git diffs and special-char coloring. Personally I can't find any use for bat: I'm a devote user of vim for editing, and it already does all of this, so why not using it to view files as well? It's satisfying to have the same interface, colors and shortcuts whether you're editing or v…

I use it for previewing files in `fzf` and `lf` (terminal file manager).

Re: I made a terminal pager

#42
post #37

Slightly related: I am an Arab who speaks Arabic and reads Arabic and the only place I ever see the unicode character ﷽ is by programmers giving an example of "unicode is too hard". Perhaps as a graphical element at the beginning of books, too. It is a part of the Arabic Presentation Forms block which explicitly is for supporting legacy encodings and should not be used.

The whole phrase is one character?

It's one codepoint, U+FDFD, with the name "Arabic Ligature Bismillah Ar-Rahman Ar-Raheem".

https://www.compart.com/en/unicode/U+FDFD

Re: I made a terminal pager

#43

I am definitely waiting for a "modern less replacement" in the same vein as fd, sd, fzf, and the rest of the under-20yo cli crew. I get that "less" is reasonably maintained still. I think the killer feature for me would be refresh. I get that this can't work for piped input, but I want `git diff` to show in a pager with a refresh button that holds my place. fzf supports both refresh and piped input, so perhaps there'…

+1 I actually came here hoping that OP had built a better `less`. Along with refresh, I'd also love to see mouse compatibility (scrolling etc.) and better performance when reading huge files.

Re: I made a terminal pager

#44
post #37

Slightly related: I am an Arab who speaks Arabic and reads Arabic and the only place I ever see the unicode character ﷽ is by programmers giving an example of "unicode is too hard". Perhaps as a graphical element at the beginning of books, too. It is a part of the Arabic Presentation Forms block which explicitly is for supporting legacy encodings and should not be used.

The whole phrase is one character?

It’s one code point that’s (in theory) meant to hold the ligature of the whole phrase. As it stands it’s only used as a demonstration of Unicode difficulty.

Re: I made a terminal pager

#45
post #37

Slightly related: I am an Arab who speaks Arabic and reads Arabic and the only place I ever see the unicode character ﷽ is by programmers giving an example of "unicode is too hard". Perhaps as a graphical element at the beginning of books, too. It is a part of the Arabic Presentation Forms block which explicitly is for supporting legacy encodings and should not be used.

The whole phrase is one character?

﷽ translates to "In the name of Allah, the Most Gracious, the Most Merciful."

But it is indeed just the single character (U+FDFD)

Re: I made a terminal pager

#46

I am definitely waiting for a "modern less replacement" in the same vein as fd, sd, fzf, and the rest of the under-20yo cli crew. I get that "less" is reasonably maintained still. I think the killer feature for me would be refresh. I get that this can't work for piped input, but I want `git diff` to show in a pager with a refresh button that holds my place. fzf supports both refresh and piped input, so perhaps there'…

https://github.com/noborus/ov is another pager, in addition to `moor` that somebody else shared.

Re: I made a terminal pager

#47

Earlier quoted context omitted.

I've noticed that subconsciously, I've started to use `bat` for interactive paging, even though that's not its main use case

Bat just uses less internally. And it deliberately breaks less’ handling of ^C, annoyingly.

Bat has an option to use a built-in pager, a Rust crate called minus

Re: I made a terminal pager

#48
post #28

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…

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

Re: I made a terminal pager

#49

I am definitely waiting for a "modern less replacement" in the same vein as fd, sd, fzf, and the rest of the under-20yo cli crew. I get that "less" is reasonably maintained still. I think the killer feature for me would be refresh. I get that this can't work for piped input, but I want `git diff` to show in a pager with a refresh button that holds my place. fzf supports both refresh and piped input, so perhaps there'…

If you want ‘git diff | pager’ to work like that, you’re out of luck. There is no way for the pager to communicate with git or the shell to rerun the command; the pager doesn’t even know what program is on the writing side of its stdin pipe. You would need something like ‘pager --command "git diff"’, where the pager invokes a command producing output. I do agree that it would be nice.

Re: I made a terminal pager

#50
post #5

[flagged]

Author here! If I were to give this post a longer title, it would be "I made a terminal pager because I needed a really good viewport component for my Go TUIs, then realized that a TUI viewport is just a mini terminal pager and I want the same text navigation and manipulation experience everywhere that I encounter long text blocks in my terminal". I take no issue at all with `less`, it's super powerful and configurab…

[flagged]
Post reply on HN