35
6
Operating system: Mac OS 10.6.2
I'd like to be able to see colour output when piping certain commands through less.
Two examples:
I've got ls aliased to ls --color=auto
, so I'd like to be able to see colour when I do this:
ls -l | less
I've also got the color extension turned on in Mercurial, so I'd like to see colour output from:
hg diff | less
and
hg st | less
After some googling, it seems like some versions of less support either -r or -R to make this work, but no dice for me. I can't see anything in the man page that looks like what I need. (-r or -R SEEM to be the right options, but again, they don't seem to work)
1It looks like the color extension is always disabled when piped. Try these commands to see what I mean:
ls --color=always | ls -R
andhg diff --config color.mode=ansi | less -R
– Harvey – 2010-08-10T17:34:32.033