Mercurial. Colour output piped to less

For mercurial, you should use the pager extension rather than piping explicitly to less. This will play nicely with the colored output options of other hg commands.


I believe you have to use --color=always for ls if you want it to do colors even when not going to stdout. Then use -r on the less command

ls --color=always -l | less -r

Do:

$ hg diff --color always | less -R

I would alias "less -R" to less. I'm not sure if there's a way to provide default options to mercurial's commands so that you don't have to remember to type --color always for hg diff all the time.