# Keyboard Shortcuts

Some shortcuts may differ if non-default keybindings are selected (e.g. Emacs, Vim, or Sublime Text).

## Accessibility

Description | Windows & Linux | Mac
--- | --- | ---
Toggle Screen Reader Support | Alt+Shift+/ | ⌃⌥/
Speak Text Editor Location | Alt+Shift+1 | ⌃⌥1
Focus Console Output | Alt+Shift+2 | ⌃⌥2
Toggle Tab Key Always Moves Focus | Alt+Shift+[ | ⌃⌥[
Focus Main Toolbar | Alt+Shift+Y | ⌃⌥Y

## Console

Description | Windows & Linux | Mac
--- | --- | ---
Move cursor to Console | Ctrl+2 | ⌃2
Clear console | Ctrl+L | ⌃L
Move cursor to beginning of line | Home | ⌘←
Move cursor to end of line | End | ⌘→
Navigate command history | Up/Down | ↑ or ↓
Popup command history | Ctrl+Up | ⌘↑
Interrupt currently executing command | Esc | ⎋
Change working directory | Ctrl+Shift+H | ⌃⇧H

## Source

Description | Windows & Linux | Mac
--- | --- | ---
Go to File/Function | Ctrl+. [period] | ⌃. [period]
Move cursor to Source Editor | Ctrl+1 | ⌃1
Toggle document outline | Ctrl+Shift+O | ⇧⌘O
New document (except on Chrome/Windows) | Ctrl+Shift+N | ⇧⌘N
New document (Chrome only) | Ctrl+Alt+Shift+N | ⌥⇧⌘N
Open document | Ctrl+O | ⌘O
Save active document | Ctrl+S | ⌘S
Save all documents | Ctrl+Alt+S | ⌃⌥S
Close active document (except on Chrome) | Ctrl+W | ⌘W
Close active document (Chrome only) | Ctrl+Alt+W | ⌥⌘W
Close all open documents | Ctrl+Shift+W | ⇧⌘W
Close other documents | Ctrl+Shift+Alt+W | ⌥⇧⌘W
Preview HTML (Markdown and HTML) | Ctrl+Shift+K | ⇧⌘K
Knit Document (knitr) | Ctrl+Shift+K | ⇧⌘K
Compile Notebook | Ctrl+Shift+K | ⇧⌘K
Compile PDF (TeX and Sweave) | Ctrl+Shift+K | ⇧⌘K
Insert chunk (Sweave and Knitr) | Ctrl+Alt+I | ⌥⌘I
Insert code section | Ctrl+Shift+R | ⇧⌘R or ⌃⇧R
Run current line/selection | Ctrl+Enter | ⌘Return
Run current line/selection (retain cursor position) | Alt+Enter | ⌥Return
Re-run previous region | Ctrl+Shift+P | ⇧⌘P
Run current document | Ctrl+Alt+R | ⌥⌘R
Run from document beginning to current line | Ctrl+Alt+B | ⌥⌘B
Run from current line to document end | Ctrl+Alt+E | ⌥⌘E
Run the current function definition | Ctrl+Alt+F | ⌥⌘F
Run the current code section | Ctrl+Alt+T | ⌥⌘T
Run previous Sweave/Rmd code | Ctrl+Alt+P | ⌥⌘P
Run the current Sweave/Rmd chunk | Ctrl+Alt+C | ⌥⌘C
Run the next Sweave/Rmd chunk | Ctrl+Alt+N | ⌥⌘N
Source a file | Ctrl+Alt+G | ⌃⌥G
Source the current document | Ctrl+Shift+S | ⇧⌘S
Source the current document (with echo) | Ctrl+Shift+Enter | ⇧⌘Return
Send current line/selection to terminal | Ctrl+Alt+Enter | ⌥⌘Return
Fold Selected | Alt+L | ⌥⌘L
Unfold Selected | Shift+Alt+L | ⌥⇧⌘L
Fold All | Alt+O | ⌥⌘O
Unfold All | Shift+Alt+O | ⌥⇧⌘O
Go to line | Shift+Alt+G | ⌥⇧⌘G
Jump to | Shift+Alt+J | ⌥⇧⌘J
Expand selection | Ctrl+Shift+Up | ⌃⌥⇧↑
Shrink selection | Ctrl+Shift+Down | ⌃⌥⇧↓
Next section | Ctrl+PgDown | ⌘⇟
Previous section | Ctrl+PgUp | ⌘⇞
Split into lines | Ctrl+Alt+A | ⌃⌥A
Edit lines from start | Ctrl+Alt+Shift+A | ⌃⌥⇧A
Switch to tab | Ctrl+Shift+. [period] | ⌃⇧. [period]
Previous tab | Ctrl+F11 or Ctrl+Alt+Left | ⌃F11 or ⌃⌥←
Previous tab (desktop only) | Ctrl+Shift+Tab | ⌃⇧⇥
Next tab | Ctrl+F12 or Ctrl+Alt+Right | ⌃F12 or ⌃⌥→
Next tab (desktop only) | Ctrl+Tab | ⌃⇥
First tab | Ctrl+Shift+F11 or Ctrl+Alt+Shift+Left | ⌃⇧F11 or ⌃⌥⇧←
Last tab | Ctrl+Shift+F12 or Ctrl+Alt+Shift+Right | ⌃⇧F12 or ⌃⌥⇧→
Navigate back | Ctrl+F9 | ⌘F9
Navigate forward | Ctrl+F10 | ⌘F10
Extract function from selection | Ctrl+Alt+X | ⌥⌘X
Extract variable from selection | Ctrl+Alt+V | ⌥⌘V
Reindent lines | Ctrl+I | ⌘I
Comment/uncomment current line/selection | Ctrl+Shift+C | ⇧⌘C
Reflow Comment | Ctrl+Shift+/ | ⌃⇧/
Reformat Selection | Ctrl+Shift+A | ⇧⌘A
Show Diagnostics for Current Project | Ctrl+Shift+Alt+D | ⌥⇧⌘D
Transpose Letters | No shortcut | ⌃T
Move Lines Up/Down | Alt+Up/Down | ⌥↑ or ↓
Copy Lines Up/Down | Shift+Alt+Up/Down | ⌥⌘↑ or ↓
Jump to Matching Brace/Paren | Ctrl+P | ⌃P
Expand to Matching Brace/Paren | Ctrl+Shift+Alt+E | ⌃⇧E
Add Cursor Above Current Cursor | Ctrl+Alt+Up | ⌃⌥↑
Add Cursor Below Current Cursor | Ctrl+Alt+Down | ⌃⌥↓
Move Active Cursor Up | Ctrl+Alt+Shift+Up | ⌃⌥⇧↑
Move Active Cursor Down | Ctrl+Alt+Shift+Down | ⌃⌥⇧↓
Find and Replace | Ctrl+F | ⌘F
Find Next | Win: F3, Linux: Ctrl+G | ⌘G
Find Previous | Win: Shift+F3, Linux: Ctrl+Shift+G | ⇧⌘G
Use Selection for Find | Ctrl+F3 | ⌘E
Replace and Find | Ctrl+Shift+J | ⇧⌘J
Find in Files | Ctrl+Shift+F | ⇧⌘F
Check Spelling | F7 | F7
Rename Symbol in Scope | Ctrl+Alt+Shift+M | ⌥⇧⌘M
Insert Roxygen Skeleton | Ctrl+Shift+Alt+R | ⌥⇧⌘R

## Editing (Console and Source)

Description | Windows & Linux | Mac
--- | --- | ---
Undo | Ctrl+Z | ⌘Z
Redo | Ctrl+Shift+Z | ⇧⌘Z
Cut | Ctrl+X | ⌘X
Copy | Ctrl+C | ⌘C
Paste | Ctrl+V | ⌘V
Select All | Ctrl+A | ⌘A
Jump to Word | Ctrl+Left/Right | ⌥← or →
Jump to Start/End | Ctrl+Home/End or Ctrl+Up/Down | ⌘↑ or ↓
Delete Line | Ctrl+D | ⌘D
Select | Shift+[Arrow] | ⇧[Arrow]
Select Word | Ctrl+Shift+Left/Right | ⌥⇧← or →
Select to Line Start | Alt+Shift+Left | ⇧⌘←
Select to Line End | Alt+Shift+Right | ⇧⌘→
Select Page Up/Down | Shift+PageUp/PageDown | ⇧⇞ or ⇟
Select to Start/End | Ctrl+Shift+Home/End or Shift+Alt+Up/Down | ⇧⌘↑ or ↓
Delete Word Left | Ctrl+Backspace | ⌥⌫ or ⌃⌥⌫
Delete Word Right | No shortcut | ⌥⌦
Delete to Line End | No shortcut | ⌃K
Delete to Line Start | No shortcut | ⌥⌫
Indent | Tab (at beginning of line) | ⇥ (at beginning of line)
Outdent | Shift+Tab | ⇧⇥
Yank line up to cursor | Ctrl+U | ⌃U
Yank line after cursor | Ctrl+K | ⌃K
Insert currently yanked text | Ctrl+Y | ⌃Y
Insert assignment operator | Alt+- | ⌥-
Insert pipe operator | Ctrl+Shift+M | ⇧⌘M
Show help for function at cursor | F1 | F1
Show source code for function at cursor | F2 | F2
Find usages for symbol at cursor (C++) | Ctrl+Alt+U | ⌥⌘U

## Completions (Console and Source)

Description | Windows & Linux | Mac
--- | --- | ---
Attempt completion | Tab or Ctrl+Space | ⇥ or ⌘Space
Navigate candidates | Up/Down | ↑ or ↓
Accept selected candidate | Enter, Tab, or Right | Return, ⇥, or →
Dismiss completion popup | Esc | ⎋

## Views

Description | Windows & Linux | Mac
--- | --- | ---
Move focus to Source Editor | Ctrl+1 | ⌃1
Zoom Source Editor | Ctrl+Shift+1 | ⌃⇧1
Move focus to Console | Ctrl+2 | ⌃2
Zoom Console | Ctrl+Shift+2 | ⌃⇧2
Move focus to Help | Ctrl+3 | ⌃3
Zoom Help | Ctrl+Shift+3 | ⌃⇧3
Move Focus to Terminal | Alt+Shift+T | ⌥⇧T
Show History | Ctrl+4 | ⌃4
Zoom History | Ctrl+Shift+4 | ⌃⇧4
Show Files | Ctrl+5 | ⌃5
Zoom Files | Ctrl+Shift+5 | ⌃⇧5
Show Plots | Ctrl+6 | ⌃6
Zoom Plots | Ctrl+Shift+6 | ⌃⇧6
Show Packages | Ctrl+7 | ⌃7
Zoom Packages | Ctrl+Shift+7 | ⌃⇧7
Show Environment | Ctrl+8 | ⌃8
Zoom Environment | Ctrl+Shift+8 | ⌃⇧8
Show Viewer | Ctrl+9 | ⌃9
Zoom Viewer | Ctrl+Shift+9 | ⌃⇧9
Show Git/SVN | Ctrl+F1 | ⌃F1
Zoom Git/SVN | Ctrl+Shift+F1 | ⌃⇧F1
Show Build | Ctrl+F2 | ⌃F2
Zoom Build | Ctrl+Shift+F2 | ⌃⇧F2
Show Connections | Ctrl+F5 | ⌃F5
Zoom Connections | Ctrl+Shift+F5 | ⌃⇧F5
Zoom Tutorial | Ctrl+Shift+F6 | ⌃⇧F6
Show Find in Files Results | Ctrl+F6 | ⌃F6
Sync Editor & PDF Preview | Ctrl+F8 | ⌘F8
Zoom left column | Ctrl+Alt+Shift+F12 | ⌃⌥⇧F12
Zoom right column | Ctrl+Alt+Shift+F11 | ⌃⌥⇧F11
Global Options | No shortcut | ⌘, [comma] (Chrome, Desktop) ⌥⌘, [comma] (Safari, Firefox)
Project Options | No shortcut | ⇧⌘, [comma]

## Help

Description | Windows & Linux | Mac
--- | --- | ---
Show Keyboard Shortcut Reference | Alt+Shift+K | ⌥⇧K
Search R Help | Ctrl+Alt+F1 | ⌃⌥F1
Find in Help Topic | Ctrl+F | ⌘F
Previous Help Topic | Shift+Alt+F2 | ⌥⇧F2
Next Help Topic | Shift+Alt+F3 | ⌥⇧F3

## Build

Description | Windows & Linux | Mac
--- | --- | ---
Install and Restart | Ctrl+Shift+B | ⇧⌘B
Load All (devtools) | Ctrl+Shift+L | ⇧⌘L
Test Package (Desktop) | Ctrl+Shift+T | ⇧⌘T
Test Package (Web) | Ctrl+Alt+F7 | ⌥⌘F7
Check Package | Ctrl+Shift+E | ⇧⌘E
Document Package | Ctrl+Shift+D | ⇧⌘D

## Debug

Description | Windows & Linux | Mac
--- | --- | ---
Toggle Breakpoint | Shift+F9 | ⇧F9
Execute Next Line | F10 | F10
Step Into Function | Shift+F4 | ⇧F4
Finish Function/Loop | Shift+F6 | ⇧F6
Continue | Shift+F5 | ⇧F5
Stop Debugging | Shift+F8 | ⇧F8
Profile selected lines | Ctrl+Alt+Shift+P | ⌃⌥⇧P

## Plots

Description | Windows & Linux | Mac
--- | --- | ---
Previous plot | Ctrl+Alt+F11 or Ctrl+Shift+PageUp | ⌥⌘F11 or ⇧⌘⇞
Next plot | Ctrl+Alt+F12 or Ctrl+Shift+PageDown | ⌥⌘F12 or ⇧⌘⇟

## Git/SVN

Description | Windows & Linux | Mac
--- | --- | ---
Diff active source document | Ctrl+Alt+D | ⌃⌥D
Commit changes | Ctrl+Alt+M | ⌃⌥M
Scroll diff view | Ctrl+Up/Down | ⌃↑ or ↓
Stage/Unstage (Git) | Spacebar | Spacebar
Stage/Unstage and move to next (Git) | Enter | Return

## Session

Description | Windows & Linux | Mac
--- | --- | ---
Quit Session (desktop only) | Ctrl+Q | ⌘Q
Restart R Session | Ctrl+Shift+F10 | ⇧⌘F10

## Terminal

Description | Windows & Linux | Mac
--- | --- | ---
New Terminal | Shift+Alt+R | ⌥⇧R
Move Focus to Terminal | Shift+Alt+T | ⌥⇧T
Previous Terminal | Shift+Alt+F11 | ⌥⇧F11
Next Terminal | Shift+Alt+F12 | ⌥⇧F12

## Main Menu (Server)

Description | Windows & Linux | Mac
--- | --- | ---
File Menu | Alt+Shift+F | ⌃⌥F
Edit Menu | Alt+Shift+E | ⌃⌥I
Code Menu | Alt+Shift+C | ⌃⌥C
View Menu | Alt+Shift+V | ⌃⌥V
Plots Menu | Alt+Shift+P | ⌃⌥P
Session Menu | Ctrl+Alt+Shift+S | ⌃⌥⇧S
Build Menu | Alt+Shift+B | ⌃⌥B
Debug Menu | Alt+Shift+U | ⌃⌥U
Profile Menu | Alt+Shift+I | ⌃⌥O
Tools Menu | Alt+Shift+S | ⌃⌥L
Help Menu | Alt+Shift+H | ⌃⌥H