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
3 Classes¶
- class IPython.terminal.shortcuts.BaseBinding(command: Callable[[prompt_toolkit.key_binding.key_processor.KeyPressEvent], Any], keys: List[str])¶
Bases:
object
- class IPython.terminal.shortcuts.RuntimeBinding(command: Callable[[prompt_toolkit.key_binding.key_processor.KeyPressEvent], Any], keys: List[str], filter: prompt_toolkit.filters.base.Condition)¶
Bases:
BaseBinding
- class IPython.terminal.shortcuts.Binding(command: Callable[[prompt_toolkit.key_binding.key_processor.KeyPressEvent], Any], keys: List[str], condition: str | None = None)¶
Bases:
BaseBinding
17 Functions¶
- IPython.terminal.shortcuts.add_binding(bindings: KeyBindings, binding: Binding)¶
- IPython.terminal.shortcuts.create_ipython_shortcuts(shell, skip=None) KeyBindings ¶
Set up the prompt_toolkit keyboard shortcuts for IPython.
- Parameters:
shell (InteractiveShell) – The current IPython shell Instance
skip (List[Binding]) – Bindings to skip.
- Returns:
the keybinding instance for prompt toolkit.
- Return type:
KeyBindings
- IPython.terminal.shortcuts.reformat_and_execute(event)¶
Reformat code and execute it
- IPython.terminal.shortcuts.reformat_text_before_cursor(buffer, document, shell)¶
- IPython.terminal.shortcuts.handle_return_or_newline_or_execute(event)¶
- 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 orsys.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(event)¶
Insert a newline after the cursor indented appropriately.
Fancier version of former
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 afterpass
,return
,raise ...
.
- IPython.terminal.shortcuts.open_input_in_editor(event)¶
Open code from input in external editor