xonsh.shells.ptk_shell.key_bindings

Key bindings for prompt_toolkit xonsh shell.

xonsh.shells.ptk_shell.key_bindings.can_compile(src)[source]

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

xonsh.shells.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.shells.ptk_shell.key_bindings.load_xonsh_bindings(ptk_bindings: KeyBindingsBase) KeyBindingsBase[source]

Load custom key bindings.

Parameters:
ptk_bindings

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

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