Page 1 of 3
RStudio cheat sheet
end
Console
Ctrl + Alt + F Run the current function definition
Ctrl + 2 Move cursor to Console
Ctrl + Alt + T Run the current code section
Ctrl + L Clear console
Ctrl + Alt + P Run previous Sweave/Rmd code
Home Move cursor to beginning of line
Ctrl + Alt + C Run the current Sweave/Rmd
End Move cursor to end of line chunk
Up arrow / Down Navigate command history Ctrl + Alt + N Run the next Sweave/Rmd chunk
arrow
Ctrl + Shift + O Source a file
Ctrl + Up arrow Popup command history
Ctrl + Shift + S Source the current document
Esc Interrupt currently executing
Ctrl + Shift + Enter Source the current document (with
command
echo)
Ctrl + Shift + H Change working directory
Alt + L Fold Selected
Shift + Alt + L Unfold Selected
Source
Alt + O Fold All
Ctrl + . Goto File/Function Shift + Alt + O Unfold All
Ctrl + 1 Move cursor to Source Editor Shift + Alt + G Go to line
Ctrl + Shift + N New document (except on Shift + Alt + J Jump to
Chrome/Windows)
Ctrl + Shift + . Switch to tab
Ctrl + Alt + Shift + New document (Chrome only)
Ctrl + F11 Previous tab
N
Ctrl + F12 Next tab
Ctrl + O Open document
Ctrl + Shift + F11 First tab
Ctrl + S Save active document
Ctrl + Shift + F12 Last tab
Ctrl + W Close active document (except on
Chrome) Ctrl + F9 Navigate back
Ctrl + Alt + W Close active document (Chrome Ctrl + F10 Navigate forward
only) Ctrl + Alt + X Extract function from selection
Ctrl + Shift + W Close all open documents Ctrl + Alt + V Extract variable from selection
Ctrl + Shift + K Preview HTML (Markdown and Ctrl + I Reindent lines
HTML)
Ctrl + Shift + C Comment/uncomment current
Ctrl + Shift + K Knit Document (knitr) line/selection
Ctrl + Shift + K Compile Notebook Ctrl + Shift + / Reflow Comment
Ctrl + Shift + K Compile PDF (TeX and Sweave) Ctrl + Shift + A Reformat Selection
Ctrl + Alt + I Insert chunk (Sweave and Knitr) Ctrl + Shift + Alt + Show Diagnostics
Ctrl + Shift + R Insert code section P
Ctrl + Enter Run current line/selection Alt + Up arrow / Move Lines Up/Down
Down arrow
Alt + Enter Run current line/selection (retain
cursor position) Ctrl + Shift + Copy Lines Up/Down
Home or Ctrl +
Ctrl + Shift + P Re-run previous region
Shift + End or
Ctrl + Alt + R Run current document Shift + Alt + Up
Ctrl + Alt + B Run from document beginning to arrow / Down
current line arrow
Ctrl + Alt + E Run from current line to document Ctrl + P Jump to Matching Brace/Paren
Page 2 of 3
Ctrl + Shift + E Expand to Matching Brace/Paren arrow
Ctrl + Shift + Alt + Select to Matching Brace/Paren Shift + Page Up / Select Page Up/Down
E Down
Ctrl + Alt + Up Add Cursor Above Current Cursor Ctrl + Shift + Select to Start/End
arrow Home or Ctrl +
Ctrl + Alt + Down Add Cursor Below Current Cursor Shift + End or
arrow Shift + Alt + Up
arrow / Down
Ctrl + Alt + Shift + Move Active Cursor Up
arrow
Up arrow
Ctrl + Backspace Delete Word Left
Ctrl + Alt + Shift + Move Active Cursor Down
Down arrow Enter or Tab (at beginning of line) Indent
Ctrl + F Find and Replace Shift + Tab Outdent
F3 (Windows) Find Next Ctrl + U Yank line up to cursor
Ctrl + G (Linux) Find Next Ctrl + K Yank line after cursor
Shift + F3 (Windows) Find Previous Ctrl + Y Insert currently yanked text
Ctrl + Shift + G (Linux) Find Previous Alt + - Insert assignment operator
Ctrl + F3 Use Selection for Find Ctrl + Shift + M Insert pipe operator
Ctrl + Shift + J Replace and Find F1 Show help for function at cursor
Ctrl + Shift + F Find in Files F2 Show source code for function at
cursor
F7 Check Spelling
Ctrl + Alt + U Find usages for symbol at cursor
(C++)
Editing (Console and Source)
Ctrl + Z Undo Completions (Console and Source)
Ctrl + Shift + Z Redo
Tab or Ctrl + Attempt completion
Ctrl + X Cut Space
Ctrl + C Copy Up arrow / Down Navigate candidates
Ctrl + V Paste arrow
Ctrl + A Select All Enter or Tab or Accept selected candidate
Right arrow
Ctrl + Left arrow / Jump to Word
Right arrow Esc Dismiss completion popup
Ctrl + Home or Jump to Start/End
Ctrl + End or Ctrl + Views
Up arrow / Down
Ctrl + 1 Move focus to Source Editor
arrow
Ctrl + 2 Move focus to Console
Ctrl + D Delete Line
Ctrl + 3 Move focus to Help
Shift + Arrow keys Select
Ctrl + 4 Show History
Ctrl + Shift + Left Select Word
arrow / Right Ctrl + 5 Show Files
arrow Ctrl + 6 Show Plots
Alt + Shift + Left Select to Line Start Ctrl + 7 Show Packages
arrow
Ctrl + 8 Show Environment
Alt + Shift + Right Select to Line End
Ctrl + 9 Show Git/SVN
Page 3 of 3
Ctrl + 0 Show Build Customize this PDF...
Ctrl + F8 Sync Editor & PDF Preview
Alt + Shift + K Show Keyboard Shortcut
Reference
Build
Ctrl + Shift + B Build and Reload
Ctrl + Shift + L Load All (devtools)
Ctrl + Shift + T Test Package (Desktop)
Ctrl + Alt + F7 Test Package (Web)
Ctrl + Shift + E Check Package
Ctrl + Shift + D Document Package
Debug
Shift + F9 Toggle Breakpoint
F10 Execute Next Line
Shift + F4 Step Into Function
Shift + F6 Finish Function/Loop
Shift + F5 Continue
Shift + F8 Stop Debugging
Plots
Ctrl + Alt + F11 Previous plot
Ctrl + Alt + F12 Next plot
Git / SVN
Ctrl + Alt + D Diff active source document
Ctrl + Alt + M Commit changes
Ctrl + Up Scroll diff view
arrow/Down arrow
Space Stage/Unstage (Git)
Enter Stage/Unstage and move to next
(Git)
Session
Ctrl + Q Quit Session (desktop only)
Ctrl + Shift + F10 Restart R Session
Last modification: 11/11/2019 8:10:40 PM
More information: defkey.com/rstudio-shortcuts