[IPython-user] Configuring the pager

Fernando Perez fperez.net@gmail....
Sat Oct 13 03:59:51 CDT 2007

On 10/12/07, Paul Moore <p.f.moore@gmail.com> wrote:
> I'd like to configure the pager used by IPython (the one I get when I
> type %magic, for example - it has a "Return to continue, q to quit"
> prompt). This is with IPython 0.8.1 on Windows XP.
> I tried to find a way of doing this in the documentation, and in the
> config file comments, but failed. Can anyone help?

Setting the PAGER environment variable to the command you want to use
should do the trick.  The code that gets the pager is in genutils.py:

def get_pager_cmd(pager_cmd = None):
    """Return a pager command.

    Makes some attempts at finding an OS-correct one."""

    if os.name == 'posix':
        default_pager_cmd = 'less -r'  # -r for color control sequences
    elif os.name in ['nt','dos']:
        default_pager_cmd = 'type'

    if pager_cmd is None:
            pager_cmd = os.environ['PAGER']
            pager_cmd = default_pager_cmd
    return pager_cmd

So if you set PAGER to anything that reasonably behaves like a pager,
ipython will honor that.



More information about the IPython-user mailing list