How to get fish-style formatting with less

2

Let's say I run a command like ls in fish and get lots of output, how do I scroll through it and still keep the fish formatting or something like it?

ls | less doesn't keep the formatting.

I know now that the coloring is due to ls being run as ls -G. ls -G produces the same coloring on the default shell on OSX. This suggests that maybe the question is about ls and not about fish.

On Arch, ls -C --color=always | less -R does it.

qwertyuiop

Posted 2015-08-03T13:24:49.547

Reputation: 21

I'm not able to check just no. I suspect you'd need ls --color=always and then an option for less to interpret the color sequences – glenn jackman – 2015-08-03T16:03:53.930

Answers

0

Yes, it's because of BSD ls, not fish. There's no --color=always, you have to export CLICOLOR_FORCE.

So something like

alias lsless="set -gx CLICOLOR_FORCE ''; ls | less; set -e CLICOLOR_FORCE" would do it.

Another option would be to just brew install coreutils and then gls --color=always | less

tolgraven

Posted 2015-08-03T13:24:49.547

Reputation: 114