Important

This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7.

If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release).

Module: terminal.shortcuts

Module to define and register Terminal IPython shortcuts with prompt_toolkit

13 Functions

IPython.terminal.shortcuts.create_ipython_shortcuts(shell)

Set up the prompt_toolkit keyboard shortcuts for IPython

IPython.terminal.shortcuts.reformat_text_before_cursor(buffer, document, shell)
IPython.terminal.shortcuts.newline_or_execute_outer(shell)
IPython.terminal.shortcuts.previous_history_or_previous_completion(event)

Control-P in vi edit mode on readline is history next, unlike default prompt toolkit.

If completer is open this still select previous completion.

IPython.terminal.shortcuts.next_history_or_next_completion(event)

Control-N in vi edit mode on readline is history previous, unlike default prompt toolkit.

If completer is open this still select next completion.

IPython.terminal.shortcuts.dismiss_completion(event)
IPython.terminal.shortcuts.reset_buffer(event)
IPython.terminal.shortcuts.reset_search_buffer(event)
IPython.terminal.shortcuts.suspend_to_bg(event)
IPython.terminal.shortcuts.force_exit(event)

Force exit (with a non-zero return value)

IPython.terminal.shortcuts.indent_buffer(event)
IPython.terminal.shortcuts.newline_autoindent_outer(inputsplitter) Callable[[...], None]

Return a function suitable for inserting a indented newline after the cursor.

Fancier version of deprecated newline_with_copy_margin which should compute the correct indentation of the inserted line. That is to say, indent by 4 extra space after a function definition, class definition, context manager… And dedent by 4 space after pass, return, raise ....

IPython.terminal.shortcuts.open_input_in_editor(event)