Custom Shortcuts

Users can customize or bind keyboard shortcuts to execute:

Access the keyboard shortcuts from the RStudio menu: Tools > Modify Keyboard Shortcuts:

A screenshot of the Tools menu bar highlighting the Modify Keyboards Shortcuts

Selecting Modify Keyboard Shortcuts will display available editor commands (commands that affect the current document’s contents, or the current selection), alongside RStudio commands (commands whose actions are scoped beyond just the current editor).

A screenshot of the available keyboard shortcuts.

Each row represents a particular command binding:

Modify a command’s shortcut by clicking on the cell containing the current shortcut key sequence, and typing the new sequence to bind the command to. As you type, the current row will be marked to show that the binding has been updated, and the shortcut field will be updated based on the keys entered.

A screenshot of a customized shortcut

If a mistake was made, press Backspace to clear a single key combination, or Delete to reset that binding to the original value it had when the widget was opened.

Commands can be either a single ‘key chord’; e.g. Ctrl+Alt+F, or also to a sequence of keys, as in Ctrl+X Ctrl+F.

You can also filter, based on the names of commands, by typing within the Filter… search box at the top left, to more easily find commands of interest:

A screenshot of the keyboard shortcut wizard filtered to 'reflow'

After a keyboard shortcut has been modified, press Apply and the shortcuts will be applied to the current session and saved for future sessions.

Handling conflicts

By default, RStudio application command bindings will override editor command bindings. If an editor command and an RStudio command are both bound to the same key sequence, the RStudio command will take precedence and the editor command will not be executed. Editor commands that are masked by an RStudio command will be crossed out and have a small icon showing the masking command:

A screenshot of a 'masked' shortcut which indicates the conflict with 'Clear Console'

If two commands are bound to the same key sequence, then that conflict will be highlighted and displayed in yellow.

A screenshot of a shortcut conflict, displaying the specific command it conflicts with.

Saving and loading

The RStudio keybindings are saved as JSON files in the directory ~/.R/rstudio/keybindings/ -- the bindings for the editor and RStudio itself at:

RStudio 1.3, and later (Windows)

~/AppData/Roaming/RStudio/keybindings/rstudio_bindings.json
~/AppData/Roaming/RStudio/keybindings/editor_bindings.json

RStudio 1.3, and later (MacOS/Linux)

~/.config/rstudio/keybindings/rstudio_bindings.json
~/.config/rstudio/keybindings/editor_bindings.json
Back to top