Search code examples
pythonkeyboard-shortcutsipythonkey-bindings

Custom Keybindings for Ipython terminal


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?


Solution

  • 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.