================================ RStudio (Mac) keyboard shortcuts ================================ First published at 1/31/2019 on https://defkey.com/rstudio-mac-shortcuts RStudio is an integrated development environment (IDE) for R programming language. R is used for graphics and statistical calculations. Distributed as free and open-source, RStudio was first released on February 2011. RStudio (Mac) has 146 shortcuts and we have listed all of them below. Console ------- Ctrl + 2 Move cursor to Console Ctrl + L Clear console Cmd + Left arrow Move cursor to beginning of line Cmd + Right arrow Move cursor to end of line Up arrow / Down arrow Navigate command history Cmd + Up arrow Popup command history Esc Interrupt currently executing command Ctrl + Shift + H Change working directory Source ------ Ctrl + . Goto File/Function Ctrl + 1 Move cursor to Source Editor Cmd + Shift + N New document (except on Chrome/Windows) Cmd + Shift + Alt + N New document (Chrome only) Cmd + O Open document Cmd + S Save active document Cmd + W Close active document (except on Chrome) Cmd + Option + W Close active document (Chrome only) Cmd + Shift + W Close all open documents Cmd + Shift + K Preview HTML (Markdown and HTML) Cmd + Shift + K Knit Document (knitr) Cmd + Shift + K Compile Notebook Cmd + Shift + K Compile PDF (TeX and Sweave) Cmd + Option + I Insert chunk (Sweave and Knitr) Cmd + Shift + R Insert code section Cmd + Enter Run current line/selection Option + Enter Run current line/selection (retain cursor position) Cmd + Shift + P Re-run previous region Cmd + Option + R Run current document Cmd + Option + B Run from document beginning to current line Cmd + Option + E Run from current line to document end Cmd + Option + F Run the current function definition Cmd + Option + T Run the current code section Cmd + Option + P Run previous Sweave/Rmd code Cmd + Option + C Run the current Sweave/Rmd chunk Cmd + Option + N Run the next Sweave/Rmd chunk Cmd + Shift + O Source a file Cmd + Shift + S Source the current document Cmd + Shift + Enter Source the current document (with echo) Cmd + Option + L Fold Selected Cmd + Shift + Option + L Unfold Selected Cmd + Option + O Fold All Cmd + Shift + Option + O Unfold All Cmd + Shift + Option + G Go to line Cmd + Shift + Option + J Jump to Ctrl + Shift + . Switch to tab Ctrl + F11 Previous tab Ctrl + F12 Next tab Ctrl + Shift + F11 First tab Ctrl + Shift + F12 Last tab Cmd + F9 Navigate back Cmd + F10 Navigate forward Cmd + Option + X Extract function from selection Cmd + Option + V Extract variable from selection Cmd + I Reindent lines Cmd + Shift + C Comment/uncomment current line/selection Cmd + Shift + / Reflow Comment Cmd + Shift + A Reformat Selection Cmd + Shift + Alt + P Show Diagnostics Ctrl + T Transpose Letters Option + Up arrow / Down arrow Move Lines Up/Down Cmd + Option + Up arrow / Down arrow Copy Lines Up/Down Ctrl + P Jump to Matching Brace/Paren Ctrl + Shift + E Expand to Matching Brace/Paren Ctrl + Shift + Alt + E Select to Matching Brace/Paren Ctrl + Alt + Up arrow Add Cursor Above Current Cursor Ctrl + Alt + Down arrow Add Cursor Below Current Cursor Ctrl + Alt + Shift + Up arrow Move Active Cursor Up Ctrl + Alt + Shift + Down arrow Move Active Cursor Down Cmd + F Find and Replace Cmd + G Find Next Cmd + Shift + G Find Previous Cmd + E Use Selection for Find Cmd + Shift + J Replace and Find Cmd + Shift + F Find in Files F7 Check Spelling Editing (Console and Source) ---------------------------- Cmd + Z Undo Cmd + Shift + Z Redo Cmd + X Cut Cmd + C Copy Cmd + V Paste Cmd + A Select All Option + Left arrow / Right arrow Jump to Word Cmd + Home Jump to Start/End Cmd + End Jump to Start/End Cmd + Up arrow / Down arrow Jump to Start/End Cmd + D Delete Line Shift + Arrow keys Select Option + Shift + Left arrow / Right arrow Select Word Cmd + Shift + Left arrow Select to Line Start Cmd + Shift + Right arrow Select to Line End Shift + Page Up / Down Select Page Up/Down Cmd + Shift + Up arrow / Down arrow Select to Start/End Option + Backspace Delete Word Left Ctrl + Option + Backspace Delete Word Left Option + Del Delete Word Right Ctrl + K Delete to Line End Option + Backspace Delete to Line Start Tab (at beginning of line) Indent Shift + Tab Outdent Ctrl + U Yank line up to cursor Ctrl + K Yank line after cursor Ctrl + Y Insert currently yanked text Option + - Insert assignment operator Cmd + Shift + M Insert pipe operator F1 Show help for function at cursor F2 Show source code for function at cursor Cmd + Option + U Find usages for symbol at cursor (C++) Completions (Console and Source) -------------------------------- Tab Attempt completion Cmd + Space Attempt completion Up arrow / Down arrow Navigate candidates Enter Accept selected candidate Tab Accept selected candidate Right arrow Accept selected candidate Esc Dismiss completion popup Views ----- Ctrl + 1 Move focus to Source Editor Ctrl + 2 Move focus to Console Ctrl + 3 Move focus to Help Ctrl + 4 Show History Ctrl + 5 Show Files Ctrl + 6 Show Plots Ctrl + 7 Show Packages Ctrl + 8 Show Environment Ctrl + 9 Show Git/SVN Ctrl + 0 Show Build Cmd + F8 Sync Editor & PDF Preview Option + Shift + K Show Keyboard Shortcut Reference Build ----- Cmd + Shift + B Build and Reload Cmd + Shift + L Load All (devtools) Cmd + Shift + T Test Package (Desktop) Cmd + Alt + F7 Test Package (Web) Cmd + Shift + E Check Package Cmd + 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 ----- Cmd + Option + F11 Previous plot Cmd + Option + F12 Next plot Git / SVN --------- Ctrl + Option + D Diff active source document Ctrl + Option + M Commit changes Ctrl + Up arrow / Down arrow Scroll diff view Space Stage/Unstage (Git) Enter Stage/Unstage and move to next (Git) Session ------- Cmd + Q Quit Session (desktop only) Cmd + Shift + F10 Restart R Session Last modified on (UTC): Monday, November 11, 2019 Defkey © All rights reserved.