Skip to content

Keyboard Shortcuts

Julia Silge edited this page Jun 3, 2024 · 4 revisions

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
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 Keymap

If you'd prefer to use RStudio keybindings, do the following:

  • Open Positron's settings (Cmd+, or Ctrl+,)
  • Search for "keymap", or navigate to Extensions > RStudio Keymap
  • Check the "Enable RStudio key mappings for Positron" checkbox

The following RStudio keymappings will be enabled:

Shortcut Description
Ctrl+1 Focus Source
Ctrl+2 Focus Console
Cmd/Ctrl+. Go to Symbol
Cmd/Ctrl+Shift+C Comment/Uncomment a line
Cmd/Ctrl+Shift+N Create a new R file
F2 Go to definition
Cmd/Ctrl+I Reindent selection
Cmd/Ctrl+Shift+A Reformat selection
Cmd/Ctrl+Alt+I Insert a new Quarto/R Markdown cell
Cmd/Ctrl+D Delete the current line
Cmd/Ctrl+Shift+R Insert section
Clone this wiki locally