Skip to content

Add 'Open Input in Editor' support to PyREPL #149392

@tanloong

Description

@tanloong

Feature or enhancement

Although multiline editing has been significantly improved in the new REPL, for users who are comfortable with Vim or other editors, writing long or complex code blocks in it can still be a little bit inconvenient. Editing the current input in an external editor can unlock the power of users' editor.

This is a common feature in many other shells:

Proposed behavior:

  1. Default shortcut: C-x C-e
  2. Create a temporary file with .py suffix and write reader.buffer to it
  3. Open it in a subprocess with $VISUAL or $EDITOR. Fall back to vi (Unix-like) or notepad (Windows) if neither variable is set
  4. After saving and exiting, load the content to reader.buffer and delete the temporary file.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

https://discuss.python.org/t/add-edit-in-external-editor-to-pyrepl-ctrl-x-ctrl-e/107170

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shelltype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions