RStudio keyboard shortcuts

RStudio's current Posit guide publishes defaults for the command palette, console, source editor, completions, panes, help, builds, debugging, plots, version control, sessions, terminals, and menus. This reference keeps Windows, Linux, and macOS differences explicit.

Windows, macOS, Linux · 204 shortcuts

Command palette and accessibility

Open the searchable command palette and move focus among RStudio panes and accessibility controls.

ActionWindowsmacOSLinux
Show the Command PaletteFirefox on Windows and Linux also documents Ctrl+Alt+Shift+P.CtrlShiftPShiftCmdPCtrlShiftP
Toggle screen reader supportAltShift/CtrlOption/AltShift/
Speak the text editor locationAltShift1CtrlOption1AltShift1
Focus console outputAlt+Shift+2 on Windows and Linux, or Ctrl+Option+2 on macOS, is also documented.Ctrl`Ctrl`Ctrl`
Toggle Tab key always moves focusAltShift[CtrlOption[AltShift[
Focus the next paneF6F6F6
Focus the previous paneShiftF6ShiftF6ShiftF6
Focus the main toolbarAltShiftYCtrlOptionYAltShiftY

Console

Move to the console, clear it, edit the current command line, browse history, and interrupt a running command.

ActionWindowsmacOSLinux
Move the cursor to the ConsoleCtrl2Ctrl2Ctrl2
Clear the consoleCtrlLCtrlLCtrlL
Move the cursor to the beginning of the lineHomeCmdLeftHome
Move the cursor to the end of the lineEndCmdRightEnd
Navigate command historyDown Arrow moves in the opposite direction.Up ArrowUp ArrowUp Arrow
Open the command history popupCtrlUpCmdUpCtrlUp
Interrupt the currently executing commandEscapeEscapeEscape
Change the working directoryCtrlShiftHCtrlShiftHCtrlShiftH

Source navigation and files

Open, save, close, preview, compile, and navigate source documents with the standard RStudio editor commands.

ActionWindowsmacOSLinux
Go to a file or functionCtrl.Ctrl.Ctrl.
Move the cursor to the Source EditorCtrl1Ctrl1Ctrl1
Toggle the document outlineCtrlShiftOShiftCmdOCtrlShiftO
Toggle the visual Markdown editorCtrlShiftF4CtrlShiftF4CtrlShiftF4
Create a new documentThe source excludes Chrome on Windows for this command.CtrlShiftNShiftCmdNCtrlShiftN
Create a new document in ChromeCtrlAltShiftNOptionShiftCmdNCtrlAltShiftN
Open a documentCtrlOCmdOCtrlO
Save the active documentCtrlSCmdSCtrlS
Save all documentsCtrlAltSCmdOptionSCtrlAltS
Close the active documentThe source lists Ctrl+Alt+W on Windows and Linux, and Option+Command+W on macOS, for Chrome.CtrlWCmdWCtrlW
Close the active document in ChromeCtrlAltWOptionCmdWCtrlAltW
Close all open documentsCtrlShiftWShiftCmdWCtrlShiftW
Close other documentsCtrlShiftAltWOptionShiftCmdWCtrlShiftAltW
Preview HTMLCtrlShiftKShiftCmdKCtrlShiftK
Knit a documentCtrlShiftKShiftCmdKCtrlShiftK
Compile a notebookCtrlShiftKShiftCmdKCtrlShiftK
Compile a PDFCtrlShiftKShiftCmdKCtrlShiftK
Insert a code chunkCtrlAltIOptionCmdICtrlAltI
Insert a code sectionCtrl+Shift+R is also listed for macOS.CtrlShiftRShiftCmdRCtrlShiftR
Run the current line or selectionCtrlEnterCmdReturnCtrlEnter
Run the current line or selection and retain the cursorAltEnterOptionReturnAltEnter
Re-run the previous regionCtrlAltPOptionCmdPCtrlAltP
Run the current documentCtrlAltROptionCmdRCtrlAltR
Run from the document beginning to the current lineCtrlAltBOptionCmdBCtrlAltB
Run from the current line to the document endCtrlAltEOptionCmdECtrlAltE
Run the current function definitionCtrlAltFOptionCmdFCtrlAltF
Run the current code sectionCtrlAltTOptionCmdTCtrlAltT
Run previous Sweave or R Markdown codeCtrlAltShiftPOptionShiftCmdPCtrlAltShiftP
Run the current Sweave or R Markdown chunkCtrlAltCOptionCmdCCtrlAltC
Run the next Sweave or R Markdown chunkCtrlAltNOptionCmdNCtrlAltN
Source a fileCtrlAltGCtrlOptionGCtrlAltG
Source the current documentCtrlShiftSShiftCmdSCtrlShiftS
Source the current document with echoCtrlShiftEnterShiftCmdReturnCtrlShiftEnter
Send the current line or selection to the terminalCtrlAltEnterOptionCmdReturnCtrlAltEnter

Source structure and tabs

Fold code, jump to lines or sections, change tab focus, navigate history, and extract symbols from the source editor.

ActionWindowsmacOSLinux
Fold selected codeAltLOptionCmdLAltL
Unfold selected codeShiftAltLOptionShiftCmdLShiftAltL
Fold all codeAltOOptionCmdOAltO
Unfold all codeShiftAltOOptionShiftCmdOShiftAltO
Go to a lineShiftAltGOptionShiftCmdGShiftAltG
Jump toShiftAltJOptionShiftCmdJShiftAltJ
Expand selectionCtrlShiftUpCtrlOptionShiftUpCtrlShiftUp
Shrink selectionCtrlShiftDownCtrlOptionShiftDownCtrlShiftDown
Go to the next sectionCtrlPage DownCtrlPage DownCtrlPage Down
Go to the previous sectionCtrlPage UpCtrlPage UpCtrlPage Up
Split into linesCtrlAltACtrlAltACtrlAltA
Edit lines from the startCtrlAltShiftACtrlAltShiftACtrlAltShiftA
Switch to a tabCtrlShift.CtrlShift.CtrlShift.
Go to the previous tabCtrl+Alt+Left on Windows and Linux, or Ctrl+Option+Left on macOS, is also listed.CtrlF11CtrlF11CtrlF11
Go to the previous tab on desktopCtrlShiftTabCtrlShiftTabCtrlShiftTab
Go to the next tabCtrl+Alt+Right on Windows and Linux, or Ctrl+Option+Right on macOS, is also listed.CtrlF12CtrlF12CtrlF12
Go to the next tab on desktopCtrlTabCtrlTabCtrlTab
Go to the first tabCtrlShiftF11CtrlShiftF11CtrlShiftF11
Go to the last tabCtrlShiftF12CtrlShiftF12CtrlShiftF12
Extract a function from the selectionCtrlAltXOptionCmdXCtrlAltX
Extract a variable from the selectionCtrlAltVOptionCmdVCtrlAltV
Reindent linesCtrlICmdICtrlI
Comment or uncomment the current line or selectionCtrlShiftCShiftCmdCCtrlShiftC
Reflow a commentCtrlShift/CtrlShift/CtrlShift/
Reformat the selectionCtrlShiftAShiftCmdACtrlShiftA
Show diagnostics for the current projectCtrlShiftAltDOptionShiftCmdDCtrlShiftAltD
Move lines up or downDown moves in the opposite direction.AltUpOptionUpAltUp
Copy lines up or downDown moves in the opposite direction.ShiftAltUpOptionCmdUpShiftAltUp
Jump to the matching brace or parenthesisCtrlPCtrlPCtrlP
Expand to the matching brace or parenthesisCtrlShiftAltECtrlShiftECtrlShiftAltE
Add a cursor above the current cursorCtrlAltUpCtrlOptionUpCtrlAltUp
Add a cursor below the current cursorCtrlAltDownCtrlOptionDownCtrlAltDown
Move the active cursor upCtrlAltShiftUpCtrlOptionShiftUpCtrlAltShiftUp
Move the active cursor downCtrlAltShiftDownCtrlOptionShiftDownCtrlAltShiftDown

Find and editing

Search and replace text, select ranges, delete words, indent code, and insert common R syntax from the editor.

ActionWindowsmacOSLinux
Find and replaceCtrlFCmdFCtrlF
Find the next matchLinux uses Ctrl+G instead of F3.F3CmdGF3
Find the previous matchLinux uses Ctrl+Shift+G instead of Shift+F3.ShiftF3ShiftCmdGShiftF3
Use the selection for FindCtrlF3CmdECtrlF3
Replace and findCtrlShiftJShiftCmdJCtrlShiftJ
Find in filesCtrlShiftFShiftCmdFCtrlShiftF
Check spellingF7F7F7
Rename a symbol in scopeCtrlAltShiftMOptionShiftCmdMCtrlAltShiftM
Insert an Roxygen skeletonCtrlShiftAltROptionShiftCmdRCtrlShiftAltR
UndoCtrlZCmdZCtrlZ
RedoCtrlShiftZShiftCmdZCtrlShiftZ
CutCtrlXCmdXCtrlX
CopyCtrlCCmdCCtrlC
PasteCtrlVCmdVCtrlV
Paste with indentCtrlShiftVShiftCmdVCtrlShiftV
Select allCtrlACmdACtrlA
Jump to the previous or next wordRight moves in the opposite direction.CtrlLeftOptionLeftCtrlLeft
Jump to the start or endThe source also lists Ctrl+Up and Ctrl+End on Windows and Linux, and Cmd+Down on macOS.CtrlHomeCmdUpCtrlHome
Delete a lineCtrlDCmdDCtrlD
Select with the arrow keysShiftArrow keysShiftArrow keysShiftArrow keys
Select a wordRight moves in the opposite direction.CtrlShiftLeftOptionShiftLeftCtrlShiftLeft
Select to the line startAltShiftLeftShiftCmdLeftAltShiftLeft
Select to the line endAltShiftRightShiftCmdRightAltShiftRight
Select a page up or downPage Down moves in the opposite direction.ShiftPage UpShiftPage UpShiftPage Up
Select to the start or endThe source also lists Ctrl+Shift+End and Shift+Alt+Down on Windows and Linux, and Shift+Cmd+Down on macOS.CtrlShiftHomeShiftCmdUpCtrlShiftHome
Delete the word to the leftThe source also lists Ctrl+Option+Backspace on macOS.CtrlBackspaceOptionBackspaceCtrlBackspace
Delete the word to the rightNot documentedOptionDeleteNot documented
Delete to the line endNot documentedCtrlKNot documented
Delete to the line startNot documentedOptionBackspaceNot documented
Indent at the beginning of a lineTabTabTab
OutdentShiftTabShiftTabShiftTab
Yank the line up to the cursorCtrlUCtrlUCtrlU
Yank the line after the cursorCtrlKCtrlKCtrlK
Insert currently yanked textCtrlYCtrlYCtrlY
Insert the assignment operatorAlt-Option-Alt-
Insert the pipe operatorCtrlShiftMShiftCmdMCtrlShiftM
Show help for the function at the cursorF1F1F1
Show source code for the function at the cursorF2F2F2
Find usages for a symbol at the cursorThe source limits this to C++.CtrlAltUOptionCmdUCtrlAltU

Completions and views

Accept code completions and move focus or zoom among RStudio's source, console, help, files, plots, packages, and panes.

ActionWindowsmacOSLinux
Attempt completionCtrl+Space on Windows and Linux, or Command+Space on macOS, is also documented.TabTabTab
Navigate completion candidatesDown Arrow moves in the opposite direction.Up ArrowUp ArrowUp Arrow
Accept the selected completionTab and Right Arrow are also documented.EnterEnterEnter
Dismiss the completion popupEscapeEscapeEscape
Move focus to the Source EditorCtrl1Ctrl1Ctrl1
Zoom the Source EditorCtrlShift1CtrlShift1CtrlShift1
Move focus to the ConsoleCtrl2Ctrl2Ctrl2
Zoom the ConsoleCtrlShift2CtrlShift2CtrlShift2
Move focus to HelpCtrl3Ctrl3Ctrl3
Zoom HelpCtrlShift3CtrlShift3CtrlShift3
Move focus to the TerminalAltShiftMOptionShiftMAltShiftM
Show HistoryCtrl4Ctrl4Ctrl4
Zoom HistoryCtrlShift4CtrlShift4CtrlShift4
Show FilesCtrl5Ctrl5Ctrl5
Zoom FilesCtrlShift5CtrlShift5CtrlShift5
Show PlotsCtrl6Ctrl6Ctrl6
Zoom PlotsCtrlShift6CtrlShift6CtrlShift6
Show PackagesCtrl7Ctrl7Ctrl7
Zoom PackagesCtrlShift7CtrlShift7CtrlShift7
Show EnvironmentCtrl8Ctrl8Ctrl8
Zoom EnvironmentCtrlShift8CtrlShift8CtrlShift8
Show ViewerCtrl9Ctrl9Ctrl9
Zoom ViewerCtrlShift9CtrlShift9CtrlShift9
Show Git or SVNCtrlF1CmdF1CtrlF1
Zoom Git or SVNCtrlShiftF1CtrlShiftF1CtrlShiftF1
Show BuildCtrlF2CmdF2CtrlF2
Zoom BuildCtrlShiftF2CtrlShiftF2CtrlShiftF2
Show ConnectionsCtrlF5CtrlF5CtrlF5
Zoom ConnectionsCtrlShiftF5CtrlShiftF5CtrlShiftF5
Zoom TutorialCtrlShiftF6CtrlShiftF6CtrlShiftF6
Show Find in Files resultsCtrlF6CmdF6CtrlF6
Sync the editor and PDF previewCtrlF8CmdF8CtrlF8
Zoom the left columnCtrlAltShiftF12CtrlOptionShiftF12CtrlAltShiftF12
Zoom the right columnCtrlAltShiftF11CtrlOptionShiftF11CtrlAltShiftF11
Show all panesCtrlAltShift0CtrlAlt0CtrlAltShift0
Add a source columnCtrlF7CmdF7CtrlF7
Open global optionsNot documentedCmd,Not documented
Open project optionsNot documentedShiftCmd,Not documented

Help, build, and debug

Open RStudio help, install or check packages, and control the debugger with the current Posit key map.

ActionWindowsmacOSLinux
Show the keyboard shortcut referenceAltShiftKOptionShiftKAltShiftK
Search R HelpCtrlAltF1CtrlOptionF1CtrlAltF1
Find in a Help topicCtrlFCmdFCtrlF
Open the previous Help topicShiftAltF2OptionShiftF2ShiftAltF2
Open the next Help topicShiftAltF3OptionShiftF3ShiftAltF3
Install and restartCtrlShiftBShiftCmdBCtrlShiftB
Load all development toolsCtrlShiftLShiftCmdLCtrlShiftL
Test a package on desktopCtrlShiftTShiftCmdTCtrlShiftT
Test a package on the webCtrlAltF7OptionCmdF7CtrlAltF7
Check a packageCtrlShiftEShiftCmdECtrlShiftE
Document a packageCtrlShiftDShiftCmdDCtrlShiftD
Toggle a breakpointShiftF9ShiftF9ShiftF9
Execute the next lineF10F10F10
Step into a functionShiftF4ShiftF4ShiftF4
Finish a function or loopShiftF7ShiftF7ShiftF7
Continue debuggingShiftF5ShiftF5ShiftF5
Stop debuggingShiftF8ShiftF8ShiftF8

Plots, Git, sessions, and terminal

Move between plots, review Git changes, stage files, restart sessions, and switch among RStudio terminal instances.

ActionWindowsmacOSLinux
Show the previous plotCtrlAltF11OptionCmdF11CtrlAltF11
Show the next plotCtrlAltF12OptionCmdF12CtrlAltF12
Diff the active source documentCtrlAltDCtrlOptionDCtrlAltD
Commit changesCtrlAltMCtrlOptionMCtrlAltM
Scroll the diff viewDown moves in the opposite direction.CtrlUpCtrlUpCtrlUp
Stage or unstage in GitSpaceSpaceSpace
Stage or unstage and move to the next itemEnterEnterEnter
Quit the desktop sessionCtrlQCmdQCtrlQ
Restart the R sessionCtrlShiftF10ShiftCmd0CtrlShiftF10
Open a new terminalShiftAltROptionShiftRShiftAltR
Move focus to the terminalShiftAltMOptionShiftMShiftAltM
Go to the previous terminalShiftAltF11OptionShiftF11ShiftAltF11
Go to the next terminalShiftAltF12OptionShiftF12ShiftAltF12

Make a printable RStudio sheet