Press Runner
Press Runner lets you run either terminal commands or VS Code extension commands with a single keyboard shortcut. Whether you're executing code files or triggering actions from other extensions, you can configure language-specific behavior and streamline your workflow without writing complex launch configurations.
⚠️ Currently, only Python and C/C++ are supported. Support for more languages is planned for future releases.
Usages
Bind your preferred shortcut to the extension command using either method below:
Option 1: For Vim Keybindings
If you use the VSCodeVim extension, add this to your settings.json
:
{
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["<leader>", "r"], // Customize your preferred key combo
"commands": ["press-runner.run"]
}
]
}
Option 2: Standard VSCode Keybinding
Alternatively, add this to your keybindings.json
:
[
{
"key": "ctrl+r", // Customize your preferred shortcut
"command": "press-runner.run",
"when": "editorTextFocus"
}
]
Tips:
- Replace the key combinations with your preferred shortcuts
- Use VSCode's command palette (
Ctrl+Shift+P
) to quickly open these files:
- "Preferences: Open Settings (JSON)"
- "Preferences: Open Keyboard Shortcuts (JSON)"
Extension Configuration
Option 1: With Settings UI (Recommended)
Configure directly through settings UI (Ctrl+, or ⌘+,) by searching for "Press Runner" commands.
Option 2: Manual Configuration
Alternatively, you can manually edit your settings.json
with language-specific commands. Example configurations are provided for Python and C++.
{
// Global setting: Controls whether all commands should run in the terminal by default
"press-runner.globalUseTerminal": "auto",
// Python commands map configuration
"press-runner.commandsMap.python.Commands": {
"plugin": "ms-python.python",
"command": "python.execInTerminal",
"terminal": "python -u ${fileName}"
},
// Controls whether Python command uses terminal
"press-runner.commandsMap.python.useTerminal": "global",
// C++ command configuration
"press-runner.commandsMap.cpp.Commands": {
"plugin": "ms-vscode.cmake-tools",
"command": "cmake.launchTarget",
"terminal": "cd ${dir} && g++ ${fileName} -o ${fileNameWithoutExt} && ${dir}${fileNameWithoutExt}"
},
// Controls whether C++ command uses terminal
"press-runner.commandsMap.cpp.useTerminal": "global",
}
Change Log
View the full Change Log on GitHub.