I set up Mercurial in .hgrc to use less as a pager together with customized colors and templates following this guide:
[pager]
pager = LESS='FSrX' less
[templates]
# ...
[color]
mode=terminfo
This works very nicely and I'd like to keep this for all commands except for hg diff. For this command only I'd like to use a completely different mechanism:
- No ANSI escape codes in output.
- Use https://github.com/dandavison/delta as a pager.
Is it possible to configure Mercurial this way?
I found a solution here which achieves this setup using the
extdiffextension.Earlier I had this workaround - to create a separate alias:
Unfortunately it's not possible to replace the original
diffcommand this way. While it's possible (although discouraged) to replace a command with an alias, in this case it doesn't work: Invoking$HG difffrom adiffalias would cause an infinite loop.