Module:terminal.shortcuts

Module to define and register Terminal IPython shortcuts withprompt_toolkit

3 Classes

classIPython.terminal.shortcuts.BaseBinding(command:collections.abc.Callable[[prompt_toolkit.key_binding.key_processor.KeyPressEvent],Any],keys:List[str])

Bases:object

classIPython.terminal.shortcuts.RuntimeBinding(command:collections.abc.Callable[[prompt_toolkit.key_binding.key_processor.KeyPressEvent],Any],keys:List[str],filter:prompt_toolkit.filters.base.Condition)

Bases:BaseBinding

classIPython.terminal.shortcuts.Binding(command:collections.abc.Callable[[prompt_toolkit.key_binding.key_processor.KeyPressEvent],Any],keys:List[str],condition:str|None=None)

Bases:BaseBinding

17 Functions

IPython.terminal.shortcuts.create_identifier(handler:Callable)
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:
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 withSIGQUIT 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 formernewline_with_copy_margin which shouldcompute the correct indentation of the inserted line. That is to say, indentby 4 extra space after a function definition, class definition, contextmanager… And dedent by 4 space afterpass,return,raise....

IPython.terminal.shortcuts.open_input_in_editor(event)

Open code from input in external editor