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:
Is it possible to configure Mercurial this way?
I found a solution here which achieves this setup using the extdiff
extension.
[extensions]
hgext.extdiff =
[extdiff]
cmd.delta =
[alias]
diff = delta
Earlier I had this workaround - to create a separate alias:
[alias]
d = !$HG diff "$@" | delta
Unfortunately it's not possible to replace the original diff
command this way. While it's possible (although discouraged) to replace a command with an alias, in this case it doesn't work: Invoking $HG diff
from a diff
alias would cause an infinite loop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With