Customizing keyboard shortcuts
Mbed Studio lets you perform most tasks from the keyboard with keyboard shortcuts (also called keybindings). You can modify existing keyboard shortcuts or add new ones to commands that do not yet have shortcuts associated with them.
Changing keyboard shortcuts
To change keyboard shortcuts:
-
Go to File > Settings > Open Keyboard Shortcuts.
-
In the Search keybindings field, type the name of a command or keybinding. You can also do a search on the context and
"when"
clauses. Note that you can click the Clear Keybindings Search Input icon to clear the field if needed. -
Hover over the shortcut you want to modify and click the Edit Keybinding pen icon to the left of the command. You can also double-click the shortcut to edit it.
The Edit Keybinding For <command> dialog box opens.
-
Update the shortcut and click OK. See Supported keys below to find out what keys you can use.
To do further changes, you can click the Open Keyboard Shortcuts in JSON icon to open the keymaps.json
file storing all the shortcuts you changed from their default values. Just change the lines corresponding to the shortcut or shortcuts you want to modify. See Using the JSON file below.
Resetting keyboard shortcuts
To reset keyboard shortcuts:
-
Search for the keyboard shortcut you want to reset.
-
Hover over the shortcut and click the Reset Keybinding icon to the left of the command.
The Reset keybinding for <command> dialog box opens.
-
Click OK.
Alternatively, you can reset a shortcut from the Edit Keybinding For <command> dialog box with the Reset button.
You can also delete the lines corresponding to the shortcut you want to reset in the keymaps.json
file. See Using the JSON file below.
Using the JSON file
All the changes you do to keyboard shortcuts are stored in a keymaps.json
file. Once you have made changes to shortcuts, you can update or delete your changes directly from the JSON file.
Keyboard rules
When you open the keymaps.json
file, you will see that two blocks are added for each shortcut you modified. The shortcut as it is currently set is presented first. It is followed by the values which were set previously. The blocks contain what are called keyboard rules.
Each rule consists of:
- A
"command"
containing the identifier of the command to execute. - A
"keybinding"
that describes the pressed keys. - An optional
"when"
clause containing a boolean expression that will be evaluated depending on the current context. If there is no"when"
clause it means the keyboard shortcut is globally available at all times.
For example, here we modified the keyboard shortcut for the Copy Line Down command. We decided to use shift+down
instead of shift+alt+down
to trigger the command when using the editor.
{
"command": "editor.action.copyLinesDownAction",
"keybinding": "shift+down",
"when": "editorTextFocus && !editorReadonly"
},
{
"command": "-editor.action.copyLinesDownAction",
"keybinding": "shift+alt+down",
"when": "editorTextFocus && !editorReadonly"
}
You can modify the "keybinding"
element in the first block or delete both blocks to reset the keyboard shortcut.
Note: It is not currently possible to change the "command"
identifiers or "when"
clauses.
Supported keys
The following keys are supported:
To use ctrl
on Windows or Linux and cmd
on macOS, use ctrlcmd
.
You can use shift
, ctrl
, alt
, meta
, option (alt)
, command (meta)
, cmd (meta)
as modifiers.
Note: Note that if you defined a custom shortcut with cmd
, command
or meta
, the same keymaps file won't work on a Windows or Linux machine as these keys don't have an equivalent.
You can also use the following strings for special keys: backspace
, tab
, enter
, return
, capslock
, esc
, escape
, space
, pageup
, pagedown
, end
, home
, left
, up
, right
, down
, ins
, del
and plus
.
Chords (two separate keypress actions) are supported and must be separated with a space.