Tuesday, February 11, 2014

Tweaking IPython

I like IPython, but I don't like numbered prompts. Also I would like to not confirm exiting IPython when I press Ctrl+D.

Regular Python session:


Configured IPython session:


How I tweaked the configuration:

1. Created the configuration file:

ipython profile create

2. Edited the configuration file ~/.config/ipython/profile_default/ipython_config.py setting some lines like this:

# Set to confirm when you try to exit IPython with an EOF (Control-D in Unix,
# Control-Z/Enter in Windows). By typing 'exit' or 'quit', you can force a
# direct exit without any confirmation.
c.TerminalInteractiveShell.confirm_exit = False

# Output prompt. '\#' will be transformed to the prompt number
c.PromptManager.out_template = '>>> '

# Continuation prompt.
c.PromptManager.in2_template = '... '

# If True (default), each prompt will be right-aligned with the preceding one.
# c.PromptManager.justify = True

# Input prompt.  '\#' will be transformed to the prompt number
c.PromptManager.in_template = '>>> '

No comments:

Post a Comment