jj
jj copied to clipboard
cli: Provide better flags for the "less" pager than default
Checklist
If applicable:
- [ ] I have updated
CHANGELOG.md
- [ ] I have updated the documentation (README.md, docs/, demos/)
- [ ] I have updated the config schema (cli/src/config-schema.json)
- [ ] I have added tests to cover my changes
I think this should be documented in https://martinvonz.github.io/jj/v0.13.0/config/#pager. The simplest thing would be to change a sentence to say:
less -FRX is the default pager in the absence of any other setting, or if
$PAGER
is exactly equal toless
.
You could also add footnote about how to disable this behavior.
If it's a chore, this doesn't have to be a blocker; we can do it in a separate PR.
Overall, I think this idea could work; we'll see if anybody gets annoyed by it. I can imagine somebody not liking -FX
, but I think these people will be few.
One thing I like about this implementation is that it won't affect people who set PAGER to less --mouse -FRX
as I used to do.
Overall, I think this idea could work; we'll see if anybody gets annoyed by it. I can imagine somebody not liking
-FX
, but I think these people will be few.
I don't like -F
, but I'm not strongly against this change. User can always override the default.
fwiw, both git and hg respect $LESS
if set.
I almost feel like the actual right answer is to have a built-in pager with the defaults jj
would prefer, then allow users to set preferring the system pager if they want.
I almost feel like the actual right answer is to have a built-in pager with the defaults
jj
would prefer, then allow users to set preferring the system pager if they want.
We discussed this a few times, but unfortunately didn't create a bug for it.
https://github.com/markbt/streampager would be a nice option, but it seems no longer maintained. It's what Sapling uses. I think I found a few more Rust pagers, but they seemed very new.
There are some nice Golang pagers (moar
and ov
), but I don't know how to link them to a Rust program. (They are not perfect; I tried using them instead of less
for a while, but there is always some minor issue that made me switch back to less
. But they have better defaults).
There are some nice Golang pagers (
moar
andov
), but I don't know how to link them to a Rust program.
as a last resort, if you really want to distribute jj as a single static binary, you could embed the entire Go binary as static data in the rust binary, and then unpack it at runtime into a binary in the same directory (or run it in-memory with https://docs.rs/memfd-exec). but i know that's kinda hacky.
As I commented on the Issue, if you are interesting all of what git does, see https://github.com/epage/git-dive/blob/main/src/git_pager.rs
As for built-in pagers, one I hadn't seen mentioned is https://crates.io/crates/minus.
Right, that's a good one! procs
uses minus
in exactly the way we would, so we can learn from them.
One annoying limitation is that minus
doesn't implement any sort of in-program help.
Closing in favor of #3024 and anything else that will come from that direction of a solution instead of special casing less