| Action | Windows / Linux | Mac |
|---|---|---|
| Run code | ||
| Execute current line or selection | Ctrl + Enter | ⌘ + Enter |
| Execute entire script | Ctrl + Shift + Enter | ⌘ + Shift + Enter |
| Source file (without echo) | Ctrl + Alt + R | ⌘ + Option + R |
| Session management | ||
| Clear console | Ctrl + L | ⌘ + L |
| Restart R session | Ctrl + Shift + F10 | ⌘ + Shift + F10 |
| Editing | ||
| Comment/uncomment lines | Ctrl + Shift + C | ⌘ + Shift + C |
| Reindent code (smart-indent) | Ctrl + I | ⌘ + I |
Insert the %>% pipe | Ctrl + Shift + M | ⌘ + Shift + M |
| Autocomplete / show suggestions | Tab | Tab |
| Navigation | ||
| Focus Source / Console panes | Ctrl + 1 / Ctrl + 2 | ⌘ + 1 / ⌘ + 2 |
| Jump to function definition (Go to file) | F2 | F2 |
| Show command history | Ctrl + Up Arrow | ⌘ + Up Arrow |
| Find in file | Ctrl + F | ⌘ + F |
| Find in project | Ctrl + Shift + F | ⌘ + Shift + F |
| File & project | ||
| Open file | Ctrl + O | ⌘ + O |
| Save file | Ctrl + S | ⌘ + S |
| Switch between open tabs | Ctrl + Tab | ⌘ + ` (backtick) |
| Help & documentation | ||
| Show help for symbol under cursor | Ctrl + F1 | ⌘ + F1 |
| Open RStudio “Keyboard Shortcuts Help” | Alt + Shift + K | ⌥ + Shift + K |
| R Markdown | ||
| Knit document | Ctrl + Shift + K | ⌘ + Shift + K |
A few bonus tips
-
Autocomplete multiple packages: start typing, then hit Tab repeatedly to cycle suggestions.
-
Swap panes: use Alt + Shift + 1/2/3/4 (Windows) or ⌥ + Shift + 1/2/3/4 (Mac) to tile Source, Console, Environment, and Viewer.
-
Zoom in/out editor font: Ctrl + + / – (Windows) or ⌘ + + / – (Mac).
-
Quickly insert assignment (
<-): pressing Alt + – (Windows) or Option + – (Mac) gives you<-. -
- ⌥ + Shift + K will open the little pop-up listing every shortcut, where you can search or browse by category.