1. Insert new code chunk

Mac: option + cmd + I

Windows/Linux: ctrl + alt + I

2. Insert pipe operator (%>%)

Mac: cmd + shift + M

Windows/Linux: ctrl + shift + M

3. Run current line of code

Mac: cmd + return/enter

Windows/Linux: ctrl + enter

4. Knit document

Mac: cmd + shift + K

Windows/Linux: ctrl + shift + K

5. Insert assignment operator

Mac: option + -

Windows/Linux: alt + -

6. Find in Files

Mac: cmd + shift + F

Windows/Linux: ctrl + shift + F

7. Fix indents

Mac: cmd + I

Windown/Linux: ctrl + I

8. Comment (and uncomment) out code

Mac: cmd + shift + C

Windown/Linux: ctrl + shift + C

Other non-markdown specific but useful

Find

Mac: cmd + F

Windows/Linux: ctrl + F

Zoom in

Mac: cmd + +

Windows/Linux: ctrl + +

Zoom out

Mac: cmd + -

Windows/Linux: ctrl + -

Undo

Mac: cmd + Z

Windows/Linux: ctrl + Z

Cut

Mac: cmd + X

Windows/Linux: ctrl + X

Copy

Mac: cmd + C

Windows/Linux: ctrl + C

Paste

Mac: cmd + V

Windows/Linux: ctrl + V

Save

Mac: cmd + S

Windows/Linux: ctrl + S

… and more

Styler package

Contains add-ins to format code nicely!

# how to install
install.packages("styler")

Restart R and you’ll find the options under Addins! I use style selection the most.

Find a more extensive list of shortcuts

In RStudio, go to the Tools menu and then Keyboard Shortcuts Help or visit this link.

Modify keyboard shortcuts

In RStudio, go to the Tools menu and then Modify Keyboard Shortcuts.

Create your own shortcut

You can create your own shortcuts but it is complicated. Here is a nice blospost about it!