Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use a pager with output from Mercurial

📅 2013-Jan-29 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ colors, extension, mercurial, pager ⬩ 📚 Archive

The output of many commands in Mercurial can spill beyond the height of the terminal. An external pager can be applied to this output automatically by using the pager extension that ships with Mercurial.

In the Mercurial configuration file, first enable the plugin by using the word pager and next indicate the pager program you would like it to use. For example:

[pager]
pager = less

To use the pager only when the output is more than one page and to preserve the color output of Mercurial, so I use this:

[pager]
pager = less --quit-if-one-screen --RAW-CONTROL-CHARS --no-init

Tried with: Mercurial 2.0.2


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧