Differences between revisions 20 and 21
Revision 20 as of 2012-11-14 20:07:36
Size: 2985
Editor: pool-173-61-134-245
Comment: Whoops, added "WARNING: terminal is not fully functional" fix in the wrong place.
Revision 21 as of 2012-11-15 01:43:54
Size: 2867
Editor: mpm
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:

<!> This extension does not work reliably on Windows. See [[http://bz.selenic.com/show_bug.cgi?id=1677|bug 1677]].

Pager Extension

This extension is distributed with Mercurial.

Author: David Soria Parra


Browse command output using an external pager


Configure your .hgrc to enable the extension and set the used pager adding these lines:

  pager = LESS='FSRX' less

  pager =

If no pager is set, the pager extension uses the environment variable $PAGER. If neither pager.pager, nor $PAGER is set, no pager is used.

If you notice BROKEN PIPE error messages, you can disable them by setting:

  quiet = True

If you see WARNING: terminal is not fully functional messages (which can interfere with scripted use of Mercurial, e.g., Tramp in Emacs), set:

  pager = LESS='FSRX' less -d

where the -d argument tells less not to complain about 'dumb' terminals.

The following options are only supported by the pager extension bundled with Mercurial version 1.1 or higher:

You can disable the pager for certain commands (e.g., commands that are interactive) by adding them to the pager.ignore list:

  ignore = version, help, update

You can also enable the pager only for certain commands using pager.attend. As of Mercurial 1.4, a default attend list with the following commands is provided:

  attend = annotate, cat, diff, export, glog, log, qdiff

If pager.attend is present, the resulting behaviour will be that the pager is used for all commands listed in pager.attend, minus those which also appear in pager.ignore (an empty pager.attend with a non-empty pager.ignore behaves as if the above attend line was specified).

To ignore global commands like hg version or hg help, you have to specify them in the global .hgrc

See also



In my opinion, p (plan9's pager) is the most suitable pager for this extension. P copies its standard input to its standard output, stopping at the end of every 22nd line, and between files, to wait for a newline from the user. Thus if the output is less than 22 lines, p works just like cat. If you've p installed on your system (via plan9port), you just need to specify it as the pager:

pager = p

And forget about AutopagerExtension or pager.ignore.

To the author of the comment above: That's what the -F and -X switches to less achieve. They simply make it to exit if the output fits in the terminal height. Plus, -R makes it interpret the color escape sequences. Net result is a cat or a pager behavior but always with colorized output.


PagerExtension (last edited 2019-07-03 01:05:56 by JordiGH)