Keyboard Shortcuts
Positron’s keyboard shortcuts, with a few exceptions, are a superset of the keyboard shortcuts used by Visual Studio Code. This table lists the shortcuts specifically added for Positron.
Global shortcuts
Shortcut | Description |
---|---|
Cmd/Ctrl+Enter | Run the selected code in the editor; if no code is selected, run the current statement |
Cmd/Ctrl+Shift+0 | Restart the interpreter currently open in the Console |
Cmd/Ctrl+Shift+Enter | Run the file open in the editor (using e.g. source() or %run ) |
F1 | Show contextual help for the topic under the cursor |
Cmd/Ctrl+K, Cmd/Ctrl+R | Show contextual help for the topic under the cursor (alternate binding) |
Cmd/Ctrl+K, F | Focus the Console |
Cmd/Ctrl+K, V | Focus the Variables pane |
Ctrl+L | Clear the Console |
R shortcuts
Shortcut | Description |
---|---|
Cmd/Ctrl+Shift+M | Insert the pipe operator (|> or %>% ) |
Alt+- | Insert the assignment operator (<- ) |
Cmd/Ctrl+Shift+L | Load the current R package, if any |
Cmd/Ctrl+Shift+B | Build and install the current R package, if any |
Cmd/Ctrl+Shift+T | Test the current R package, if any |
Cmd/Ctrl+Shift+E | Check the current R package, if any |
Cmd/Ctrl+Shift+D | Document the current R package, if any |
RStudio keybindings
If you’d prefer to use RStudio keybindings, see our instructions on how to enable them for Positron.
Custom shortcuts
Because Positron is built on top of VS Code, you can use its infrastructure for defining custom keybindings. You can use this infrastructure with any Positron-specific commands, such as workbench.action.executeCode.console
or workbench.action.executeCode.silently
.
As a specific example, you could add the following to your user keybindings.json
(access this file from the Command Palette with Open Keyboard Shortcuts (JSON)) to make a keyboard shortcut to create a reprex from your current selection:
{
"key": "Cmd+Shift+R",
"command": "workbench.action.executeCode.console",
"when": "editorTextFocus",
"args": {
"langId": "r",
"code": "reprex::reprex_selection()",
"focus": true
}
}
Be aware that Positron’s integrated terminal can intercept some keyboard shortcuts. You can set up a keybinding to skip the shell by specifying its command in the terminal.integrated.commandsToSkipShell
setting, either via the settings UI or by editing settings.json
:
{
"terminal.integrated.commandsToSkipShell": [
// Ensure the keyboard shortcut for focusing the console skips the shell
"workbench.action.positronConsole.focusConsole"
]
}