Guide to Setting a Hotkey for Running the
Current File in Interactive Window in VS Code
Introduction
This guide explains how to set a hotkey to run the current file in the interactive
window in Visual Studio Code. It assumes you are using the Python and Jupyter
extensions.
Steps
1. Install Required Extensions:
• Install the Python and Jupyter extensions.
• Go to Extensions on the sidebar of VS Code and search for and install
the mentioned extensions.
2. Open Keyboard Shortcuts Settings:
• Go to File > Preferences > Keyboard Shortcuts, or use the shortcut
Ctrl + K Ctrl + S.
3. Add a New Hotkey:
• In the top right corner of the Keyboard Shortcuts page, click the
icon to open [Link]. This file contains your keyboard
shortcut settings.
4. Add New Settings:
• Add a new entry to [Link] to run the current file in the
interactive window. For example:
identifierstyle
1 [
2 {
3 "key": "ctrl+shift+i",
4 "command ": "[Link] ",
5 "when ": "editorTextFocus && editorLangId == 'python '"
6 }
7 ]
8
1
• Here, ctrl+shift+i is chosen as the hotkey. You can change this
key combination to whatever you prefer.
5. Save and Close the Settings File:
• Save your changes and close the [Link] file.
Conclusion
Now you can use the hotkey you defined to run the current file in the interactive
window. If you need to set up other commands, you can search for the respective
command and define your hotkey.