autopager is an extension for Mercurial that pages output only if it exceeds the terminal's height

On Unix, this extension uses ioctl(2) to determine the terminal's dimensions. On Windows, GetConsoleScreenBufferInfo is used. If neither is available or unable to determine the dimensions, the LINES and COLUMNS environment variables are used.

Default settings:

; Like in the pager extension, this helps alleviate broken pipes
quiet = False
; The size of your shell prompt in lines
promptsize = 1
; The pager to use
pager = [environment variable PAGER]

If neither pager nor PAGER is set, the extension does nothing.

Note: Output to stderr is sent to the pager as well. If the pager isn't invoked, it's preserved (instead of being sent to stdout).

Paging for certain commands can be enabled or disabled:

ignore = version, help, update
; or...
attend = log

Tips for using this extension with less

  • If you don't like how less clears the screen when you quit, try the -X/--no-init switch. This could cause other issues depending on your terminal emulator - or it could work fine.
  • If you're using another extension that colorizes a command's output, try the -R/--RAW-CONTROL-CHARS switch. This will cause less to avoid escaping color control codes.

Debugging tips

  • If you get an exception without the traceback, try setting the DEBUGAUTOPAGER environment variable when running hg. The extension will then wrap only stdout


Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.