I'm writing a Powerline theme for IPython and I'd like to show the Vi mode in the prompt. That will be useful but is it possible? Does IPython provide a method? I couldn't find it.
This is what I want (now the INSERT segment is hard coded):
Since IPython has switched to prompt_toolkit it does not, indeed, respect .inputrc, there are plane to do so but prompt_toolkit (PTK) author need to find time (or funds to work on it...).
PTK have a vi input mode which is not perfect (Bug reports and PR welcome), and can be enable in IPython. Better than just give you the answer, here is how to find it yourself. run ipython with --help-all option, grep for vi, and keep a couple of lines after (-A2) and after before (-B2):
$ ipython --help-all | grep vi -B2 -A2
...snip...
--TerminalInteractiveShell.editing_mode=<Unicode>
Default: 'emacs'
Shortcut style to use at the prompt. 'vi' or 'emacs'.
...snip...
So there you go, you can start IPython with --TerminalInteractiveShell.editing_mode='vi', or set the configuration option in the IPython configuration file c.TerminalInteractiveShell.editing_mode='vi'.
Since IPython has switched to
prompt_toolkit
it does not, indeed, respect.inputrc
, there are plane to do so butprompt_toolkit
(PTK) author need to find time (or funds to work on it...).PTK have a vi input mode which is not perfect (Bug reports and PR welcome), and can be enable in IPython. Better than just give you the answer, here is how to find it yourself. run
ipython
with--help-all
option, grep forvi
, and keep a couple of lines after (-A2) and after before (-B2):So there you go, you can start IPython with
--TerminalInteractiveShell.editing_mode='vi'
, or set the configuration option in the IPython configuration filec.TerminalInteractiveShell.editing_mode='vi'
.You can also find all configuration options in the online IPython documentation.