Search code examples
pythonvi

Standard python interpreter has a vi command mode?


I was working a bit in the python interpreter (python 2.4 on RHEL 5.3), and suddenly found myself in what seems to be a 'vi command mode'. That is, I can edit previous commands with typical vi key bindings, going left with h, deleting with x...

I love it - the only thing is, I don't know how I got here (perhaps it's through one of the modules I've imported: pylab/matplotlib?).

Can anyone shed some light on how to enable this mode in the interpreter?


Solution

  • Ctrl-Alt-J switches from Emacs mode to Vi mode in readline programs.

    Alternatively add "set editing-mode vi" to your ~/.inputrc