Prompt Toolkit 2+ Key Bindings (xonsh.ptk_shell.key_bindings)

Key bindings for prompt_toolkit xonsh shell.


Returns whether the code can be compiled, i.e. it is valid xonsh.

xonsh.ptk_shell.key_bindings.carriage_return(b, cli, *, autoindent=True)[source]

Preliminary parser to determine if ‘Enter’ key should send command to the xonsh parser for execution or should insert a newline for continued input.

Current ‘triggers’ for inserting a newline are: - Not on first line of buffer and line is non-empty - Previous character is a colon (covers if, for, etc…) - User is in an open paren-block - Line ends with backslash - Any text exists below cursor position (relevant when editing previous multiline blocks)

xonsh.ptk_shell.key_bindings.load_xonsh_bindings(ptk_bindings: prompt_toolkit.key_binding.key_bindings.KeyBindingsBase)prompt_toolkit.key_binding.key_bindings.KeyBindingsBase[source]

Load custom key bindings.

ptk_bindings :

The default prompt toolkit bindings. We need these to add aliases to them.

xonsh.ptk_shell.key_bindings.wrap_selection(buffer, left, right=None)[source]