Search code examples
pythonvisual-studio-codeipythonpython-interactive

Pressing Escape in VS Code Interactive (IPython) deletes the cell. How can I disable this?


I normally write code in a python script (.py-file) divided into cells (with # %%) and execute the cells or single lines of code in an interactive window to the right of the script.

The interactive window also has an interactive python shell at the bottom, which I use if I quickly want to write some code but not clutter my script. However, pressing Esc deletes the line. I can bring it back by pressing up arrow, but this only saves the last thing I typed, and I quite frequently press Esc accidentally due to using Vim at the same time.

Is it possible to disable Esc deleting the line? (Using Vim I can just press dd anyways...) I didn't find anything in the settings.


Solution

  • Open the shortcut key setting page (Ctrl+K+S) and enter "Escape" for search.

    enter image description here

    The settings in the page to achieve the effect you want.

    enter image description here