Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: Allow spacebar to advance pager #19

Open
larsks opened this issue Feb 6, 2022 · 3 comments
Open

RFE: Allow spacebar to advance pager #19

larsks opened this issue Feb 6, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@larsks
Copy link

larsks commented Feb 6, 2022

Every time I use --pager my fingers bang helplessly on the spacebar until I remember that I have to use pageup/pagedown, etc. Any chance you could allow the spacebar to advance the pager as well so that the behavior matches other common pagers?

@ibeex
Copy link

ibeex commented Feb 6, 2022

It would be great if you can add also vi style navigation and search...

@willmcgugan willmcgugan added the enhancement New feature or request label Feb 13, 2022
@ernstki
Copy link

ernstki commented Feb 27, 2022

rich-cli's pager is pretty neat, and I'm not knocking it. But on any platform other than straight Windows (without WSL or Cygwin), you already have a pager that does all the things you're asking for here.

Adding --force-terminal every time and piping into less -R is a lot to ask, but this is a great use for shell functions:

# simple wrapper, assuming Bash shell…
richp() { command rich --force-terminal "$@" | less -RX; }
# less -RX → process terminal escapes (e.g., colors), don't clear screen on quit

# handle redirection/piped input as well
richp() {
    local stdin=-
    [[ -t 0 ]] && stdin=
    command rich --force-terminal $stdin "$@" | less -RX
}

Examples:

README=https://raw.githubusercontent.com/Textualize/rich-cli/main/README.md
curl $README | richp -m
richp $README

# other options pass through just fine
richp $README -d 0,$(((COLUMNS-80)/2))

@jdsalmonson
Copy link

It would be great to have emacs-style navigation as well. Perhaps there can be a configuration file (say ".richrc") that stores the user's configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants