Is it possible to define custom keybindings and/or desactivate the default ones for Ipython terminal interface?
For example, I have bound C+j and C+l to move left and right in my terminal by configuring the ~/.inputrc file (Linux), but when using Ipython terminal, C+l is captured before and actually clears the screen.
So my questions are:
1) Is it possible to desactivate some keybindings of Ipython
2) Even better, is it possible to totally configure Ipython keymap?
Reposting as an answer:
You can set InteractiveShell.readline_parse_and_bind in a config file (default value is here). It takes a list of readline config commands.
IPython also uses .inputrc, but things in that config value take precendence, and Ctrl+L is in there by default.
For newer versions of IPython, TerminalInteractiveShell.shortcuts handles adds/changes to keybinds.
For example, to add C-] in addition to End for accepting the autocomplete suggestion, I added the following to my ipython_config.py:
c.TerminalInteractiveShell.shortcuts = [
{
"command": "IPython:auto_suggest.accept_or_jump_to_end",
"new_keys": ["c-]"],
"create": True,
}
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With