Keyboard Shortcuts for RStudio

Are you finding the Keyboard shortcuts for RStudio? RStudio provides shortcuts to help you quickly work on documents. Here is the list of all shortcuts that you can use in RStudio. This post will help you to check and make your RStudio work faster with Most Used.

Console 

Keyboard Shortcuts (Windows)Menu Description
Ctrl+2Move cursor to console
Ctrl+LClean console
HomeMove cursor to beginning of line
EndMove cursor to end of line
Up/DownNavigate command history
Ctrl+UpPopup command history
EscInterrupt currently executing command
Ctrl+Shift+HChange working directory

Source 

Keyboard Shortcuts (Windows)Menu Description
Ctrl+.Goto file/function
Ctrl+1Move cursor to source editor
Ctrl+Shift+NNew document (except on chrome/windows)
Ctrl+Alt+Shift+NNew document (Chrome only)
Ctrl+OOpen document
Ctrl+SSave active document
Ctrl+WClose active document (except on Chrome)
Ctrl+Alt+WClose active document (Chrome only)
Ctrl+Shift+WClose all open documents
Ctrl+Shift+KPreview HTML (markdown and HTML)
Ctrl+Shift+KCompile notebook/compile PDF (TeX and Sweave)
Ctrl+Alt+IInsert chunk (Sweave and Knitr)
Ctrl+Shift+RInsert code section
Ctrl+EnterRun current line/selection
Alt+EnterRun current line/selection (retain cursor position)
Ctrl+Shift+PRe-run previous region
Ctrl+Alt+RRun current document
Ctrl+Alt+BRun from document beginning to current line
Ctrl+Alt+ERun from current line to document end
Ctrl+Alt+FRun from current line to document end
Ctrl+Alt+TRun the current code section
Ctrl+Alt+PRun previous sweave/Rmd code
Ctrl+Alt+CRun the current Sweave/Rmd chunk
Ctrl+Alt+NRun the next Sweave/Rmd chunk
Ctrl+Shift+OSource a file
Ctrl+Shift+SSource the current document
Ctrl+Shift+EnterSource the current document (with echo)
Alt+LFold selected
Shift+Alt+LUnfold selected
Alt+OFold all
Shift+Alt+OUnfold all
Shift+Alt+GGo to line
Shift+Alt+JJump to
Ctrl+Shift+.Switch to tab
Ctrl+F11Previous tab
Ctrl+F12Next tab
Ctrl+Shift+F11First tab
Ctrl+Shift+F12Last tab
Ctrl+F9Navigate back
Ctrl+F10Navigate forward
Ctrl+Alt+XExtract function from selection
Ctrl+Alt+VExtract variable from selection
Ctrl+IReindent lines
Ctrl+Shift+CComment/uncomment current line/selection
Ctrl+Shift+/Reflow comment
Ctrl+Shift+AReformat selection
Ctrl+Shift+Shift+PShow diagnostics
Alt+Up/DownMove lines Up/Down
Shift+Alt+Up/DownCopy lines Up/Down
Ctrl+PJump to matching Brace/Paren
Ctrl+Shift+EExpand to matching Brace/Paren
Ctrl+Shift+Alt+ESelect to matching Brace/Paren
Ctrl+Alt+UpAdd cursor above current cursor
Ctrl+Alt+DownAdd cursor beow current cursor
Ctrl+Alt+Shift+UpMove active cursor up
Ctrl+Alt+Shift+DownMove Active Cursor Down
Ctrl+FFind and replace
F3Find next
Shift+F3Find previous
Ctrl+F3Use selection for find
Ctrl+Shift+JReplace and find
Ctrl+Shift+FFind in files
F7Check spelling

Completions (Console and Source) 

Keyboard Shortcuts (Windows)Menu Description
Tab/Ctrl+SpaceAttempt completion
Up/DownNavigate candidates
Enter/Tab/RightAccept selected candidate
EscDismiss completion popup

Views 

Keyboard Shortcuts (Windows)Menu Description
Ctrl+1Move focus to Source Editor
Ctrl+2Move focus to Console
Ctrl+3Move focus to Help
Ctrl+4Show History
Ctrl+5Show files
Ctrl+6Show plots
Ctrl+7Show packages
Ctrl+8Show environment
Ctrl+9Show git/svn
Ctrl+0Show build
Ctrl+F8Sync editor & pdf preview
Alt+Shift+KReference

Build 

Keyboard Shortcuts (Windows)Menu Description
Ctrl+Shift+BBuild and reload
Ctrl+Shift+LLoad all (devtools)
Ctrl+Shift+TTest package (desktop)
Ctrl+Alt+F7Test package (web)
Ctrl+Shift+ECheck package
Ctrl+Shift+DDocument package

Debug

Keyboard Shortcuts (Windows)Menu Description
Shift+F9Toggle breakpoint
F10Execute next line
Shift+F4Step into function
Shift+F6Finish function/loop
Shift+F5Continue
Shift+F8Stop debugging

Plots

Keyboard Shortcuts (Windows)Menu Description
Ctrl+Alt+F11Previous plot
Ctrl+Alt+F12Next plot

Git / SVN 

Keyboard Shortcuts (Windows)Menu Description
Ctrl+Alt+DDiff active source document
Ctrl+Alt+MCommit changes
Ctrl+Up/DownScroll diff view
SpacebarStage/unstage(Git)
ENterStage/unstage and move to next (Git)

Session

Keyboard Shortcuts (Windows)Menu Description
Ctrl+QQuit Session (desktop only)
Ctrl+Shift+F10Restart R Session

Editing (Console and Source) 

Keyboard Shortcuts (Windows)Menu Description
Ctrl+ZUndo
Ctrl+Shift+ZRedo
Ctrl+XCut
Ctrl+CCopy
Ctrl+VPaste
Ctrl+ASelect all
Ctrl+Left/RightJump to word
Ctrl+Home/End/Ctrl+Up/DownJump to start/end
Ctrl+DDelete line
Shift+ArrowSelect
Ctrl+Shift+Left/RightSelect word
Alt+Shift+LeftSelect to line start
Alt+Shift+RIghtSelect to line end
Shift+Page Up/Shift+Page downSelect page up/down
Ctrl+Shift+Home/EndSelect page start/end
Ctrl+BackspaceDelete word left
TabIndent
Shift+TabOutdent
Ctrl+UYank line up to cursor
Ctrl+KYank line after cursor
Ctrl+YInsert currently yanked text
Alt+-Insert assignment operator
Ctrl+Shift+MInsert pipe operator
F1Show help for function at cursor
F2Show source code for function at cursor
Ctrl+Alt+UFind usages for symbol at cursor (C++)

Related Articles:

  FiveM Game Keyboard Shortcuts

Well, there you have it, RStudio shortcuts list. You might not have known about these shortcuts. If I’ve left important something out in this list, feedback is appreciated and welcome on the Make A Public List.

Feel free to comment below.

Was this article helpful?
YesNo

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.