Customizing Keyboard Shortcuts
You can now customize keyboard shortcuts in RStudio -- you can bind keys to execute RStudio application commands, editor commands, or (using RStudio Addins) even user-defined R functions.
Access the keyboard shortcuts by clicking
Tools -> Modify Keyboard Shortcuts...:
You will then see the set of 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).
Each row represents a particular command binding -- the command's Name, the keyboard Shortcut it is bound to, and the Scope where that binding is active.
You can modify a command's shortcut by clicking on the cell containing the current shortcut key sequence, and typing the new sequence you'd like 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.
If you made a mistake, you can 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'; for example,
Ctrl+Alt+F, or also to a sequence of keys, as in
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:
After you've updated the bindings to your liking, click
Apply and the shortcuts will be applied to the current session and saved for future sessions.
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:
If two commands are bound to the same key sequence, then that conflict will be highlighted and displayed in yellow.
Saving and Loading
The RStudio keybindings are saved as JSON files in the directory
~/.R/rstudio/keybindings/ -- you can find the bindings for the editor and RStudio itself at:
RStudio 1.2 and prior
RStudio 1.3+ (Windows)
RStudio 1.3+ (MacOS/Linux)
Questions? Comments? Suggestions? Please get in touch at RStudio Support.