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.
2
Answers
Put the following in keybindings.json (which you can open with the
Preferences: Open Keyboard Shortcuts (JSON)
command in the command palette):The default keybinding at the time of this writing is:
Open the shortcut key setting page (
Ctrl+K+S
) and enter"Escape"
for search.The settings in the page to achieve the effect you want.