Simple Commands
Add configurable buttons to the VSCode status bar (bottom left).
Features
- Add custom buttons to the status bar
- Configure buttons via VSCode settings or a
.commands file in the workspace
- Support for icons using
$(iconName) syntax
- Customize button colors
- Run shell commands in a terminal, or any VSCode command
- Reuse the button's terminal, the active terminal, or a new one each time
- Show/hide buttons based on a condition (e.g. only if a file exists)
- Autocompletion, snippets and validation while editing settings or a
.commands file
- VSCode command ID autocompletion for
vscode buttons in a .commands file
Configuration
Configure your buttons in VSCode settings:
{
"simple-commands.buttons": [
{
"name": "$(gear) Settings",
"command": "workbench.action.openSettings",
"type": "vscode",
"color": "#007acc"
},
{
"name": "$(file-code) Open File",
"command": "workbench.action.files.openFile",
"type": "vscode",
"color": "#00ff00"
}
]
}
name (required): Button text, supports icons like $(gear)
type (required): shell (runs command in a terminal) or vscode (runs command as a VSCode command ID)
command (required): Shell command or VSCode command ID, depending on type
color (optional): Text color in hex format (e.g., #007acc). shell buttons also color their
terminal with the nearest terminal color
terminalTarget (optional, shell only): Overrides the simple-commands.terminalTarget setting
condition (optional): Only show the button when it holds (see below)
Terminals
shell buttons open a terminal named after the button (without the $(icon) part), with the
button's icon on its tab. Which terminal is used is set by simple-commands.terminalTarget:
reuse (default): the button's own terminal, opened on first click and reused afterwards
active: the currently active terminal
new: a new terminal on every click
If there is no terminal to use, a new one is opened.
Migrating from 1.x
type is now required
"type": "command" was renamed to "shell", and "type": "run" to "vscode"
title was removed: the terminal is named after the button. Old values are ignored
Invalid buttons are not shown. In a .commands file they are underlined in red and listed in the
Problems panel; in settings, an error notification lists them.
.commands File
Buttons can also be defined in a .commands file at the root of a workspace folder, using the
same JSON array format as simple-commands.buttons. These buttons are added alongside (not
instead of) the ones from settings, and the file is watched for live reload.
[
{
"name": "$(rocket) Dev Server",
"command": "npm run dev",
"type": "shell"
}
]
The file is treated as JSON and backed by a schema, so it gets the same autocompletion, hover
docs and validation as simple-commands.buttons in settings. Trigger suggestions inside the array
to insert a new shell or vscode button snippet.
Conditions
Add a condition to a button to only show it when it holds. Each condition has a type, so more
kinds can be added later without breaking existing buttons.
{
"name": "$(rocket) Dev Server",
"command": "npm run dev",
"type": "shell",
"condition": {
"type": "file_exists",
"path": "package.json"
}
}
file_exists: shown only if path (relative to the workspace folder) exists. The workspace is
watched, so the button appears/disappears as the file is created/deleted.
- An unrecognized
condition.type is treated as always true, so buttons stay visible on older
versions of this extension.
Common Commands
workbench.action.openSettings - Open settings
workbench.action.openSettingsJson - Open settings.json
workbench.action.showCommands - Show command palette
workbench.action.terminal.new - New terminal
workbench.action.tasks.runTask - Run task
Usage
- Install the extension
- Add your button configurations either:
- in VSCode settings (JSON), under
simple-commands.buttons, or
- in a
.commands file at the root of the workspace folder
- Buttons will appear in the status bar automatically, and update as settings or
.commands
change
License
MIT