Having this feature would be helpful for editing longer or more complex code blocks using familiar external editors such as Vim, Neovim, or Emacs.
Basic idea:
- Press Ctrl+X Ctrl+E
- The current input buffer opens in the editor set by $VISUAL or $EDITOR. If neither environment variable is set, it falls back to
notepadon Windows,vion Unix-like systems. - After saving and exiting the editor, the content is brought back to the REPL.
This is a screen recording showing how it looks like: https://github.com/user-attachments/assets/30e7a471-9eaf-454d-92af-025834f03938
I’ve implemented a draft: GitHub - tanloong/cpython at pyrepl-edit-in-external-editor · GitHub