eza-community / eza

A modern alternative to ls
https://eza.rocks
European Union Public License 1.2
12.08k stars 216 forks source link

feat: pagination #751

Open flexyboooy opened 10 months ago

flexyboooy commented 10 months ago

Am I too stoned rn or is eza missing a feature for output pagination?

Sure, I could pipe (huh huh) to e.g. less, but then I lose all the pretty colours, don't I?

Certainly not a priority but would be dang useful when listing subdirectories ...

MartinFillon commented 10 months ago

what do you mean by pagination, could you please provide some examples so that we can think about it

rsholmes commented 10 months ago

Like what less does

MartinFillon commented 9 months ago

Well this could be an idea to implement. We need to have a deeper look at this

ashmanskas commented 8 months ago

I wondered about this too. It looks as if you can already keep the pretty colors if you do

eza --color=always | less -R

daviessm commented 8 months ago

bat does this and I quite like it, it's definitely worth considering.

RedSnt commented 2 months ago

This would be really nice. Like @ashmanskas wrote, this is already possible but the -G (grid) flag doesn't really work when piped into less unless you supply a --width value.

Workaround for this is doing something like this:

eza --color=always --grid --width $COLUMNS | less -FRi
(took the liberty of using F to exit if pagination is not needed and i for ignoring case when searching within less)

cafkafk commented 2 months ago

I don't think we should ever default to pagination, but we could have something like bat's --pager --paging and such, I think there is also a relevant environment variable for setting a pager.

We shouldn't implement an actual pager ourselves thou, just the ability to work with one.

I think it would be nice to just start simply with a --paging flag that sends the output of eza into a pager, then expand to auto/always/never (making no arg default to always) to page contextually, based on if we'd use more lines than the terminal currently has, then we can look into --pager <pager> or some PAGER or EZA_PAGER that takes precedence over the system pager (we should ensure that the PAGER var is common).

That is also to say, one PR at a time, building out this system may be overwhelming if done in one large PR!

cafkafk commented 2 months ago

I don't think we should ever default to pagination

Well, unless we have something like e.g. a config file to set it of course... but again, let's start with the simple case :p

skewb1k commented 2 weeks ago

eza --color=always --grid --width $COLUMNS | less -FRi

sad that it doesn't work with --icons (at least on my machine)

cafkafk commented 1 week ago

(that's an issue with less, not eza)