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

14 Functions

IPython.terminal.shortcuts.has_focus(value: Union[str, Buffer, UIControl, Container, MagicContainer])

Wrapper around has_focus adding a nice __name__ to tester function

IPython.terminal.shortcuts.create_ipython_shortcuts(shell, for_all_platforms: bool = False) KeyBindings

Set up the prompt_toolkit keyboard shortcuts for IPython.

Parameters:
  • shell (InteractiveShell) – The current IPython shell Instance

  • for_all_platforms (bool (default false)) – This parameter is mostly used in generating the documentation to create the shortcut binding for all the platforms, and export them.

Returns:

the keybinding instance for prompt toolkit.

Return type:

KeyBindings

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)

Dismiss completion

IPython.terminal.shortcuts.reset_buffer(event)

Reset buffer

IPython.terminal.shortcuts.reset_search_buffer(event)

Reset search buffer

IPython.terminal.shortcuts.suspend_to_bg(event)

Suspend to background

IPython.terminal.shortcuts.quit(event)

Quit application with SIGQUIT if supported or sys.exit otherwise.

On platforms that support SIGQUIT, send SIGQUIT to the current process. On other platforms, just exit the process with a message.

IPython.terminal.shortcuts.indent_buffer(event)

Indent buffer

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)

Open code from input in external editor