pythonread-eval-print-looppython-interactivepython-3.13

Python 3.13 REPL with vim or emacs key bindings?


I just upgraded to Python 3.13 and found that the vim key bindings that I had set up via readline and ~/.editrc, which worked in previous releases of the Python REPL, no longer work. Is there some way to get vim (or emacs) key bindings to work in the new REPL?


Solution

  • It looks like I have already found the answer, in PEP 762 – REPL-acing the default REPL.

    It explains in the Rationale section that the designers of the new REPL made a trade-off: to sacrifice configurability in order to gain features newly implemented from scratch, such as multi-line editing. For example, you can now hit up-arrow and edit a whole multi-line Python statement instead of hitting up-arrow to get just one line of a previously entered statement. This would be too hard to interface with readline and editline, which are relatively complex and call for features that are not implemented in PyREPL.