#### RStudio shortcuts for laptop productivity

##### November 2, 2019 - 3 minutes

I spent last week working in train cars, coffee shops, and libraries. My to-do list was mostly data analysis, so I was a little worried about shrinking my workstation workflow to just my 13” laptop. The reduced screen real-estate and lack of a mouse, motivated me to experiment a lot with RStudio’s keyboard shortcuts. These are the six that I found myself using the most.

### Zoom Plots

Control + Shift + 6

My favorite shortcut of the bunch

By far the biggest pane of working on a small screen for me is plotting. Trying to inspect even midly complex plots on 14 of of 13” is a bad time. And if you use any plot() based graphics, you will be seeing the “figure margins too large” error message a lot.

Repeating this shorcut shrinks panels back to their prior sizes. Also worth mentioning, this does not move your cursor. So if you just ran into a fatal plot margin error in the Console, you just zoom then u-arrow. + Return to rerun and dodge the fatal margin error.

### Focus to:

Learning to navitage RStudio with less mouse helps even at a desk workstation, and I felt it become even more valuable when all I had was the trackpad. These are the “Big 3” re-focusers, that I use all the time.

#### Console

Control + 2

Moving the active cursor to the Console is great for all things interactive.

#### Editor

Control + 1

Of course you’ll have to move back. Remembering the “one, two” pattern for was helpful.

#### Terminal

Option + Shift + T

This one was harder for me to remember becasue it wasn’t in the Control + # pattern. But I use the git CLI a lot, so I had to learn it.

### Switch between Editor tabs

Control + Option + l/r arrows

This is very very useful for switching between R scripts or View() windows.

### Show all panels

Control + Shift + 0

I found this most useful after I’d hit the wrong Zoom shortcut by mistake, it was effectivly my IDE reset switch.

### Conclusion

Now that I’m back to my normal workstation, I’m still using all of these shortcuts. It does require a lot of conscious effort at the begining to use the shortcuts and not bail out to the trackpad. But it’s totally worth it, just after the one week of trying I can feel my muscle memory is improving.

You can see all of RStudios available shortcuts for yourself with yet another keyboard shortcut Option + Shift + K.

The screen screen recordings in this post are made with KeyCastr which is also a great tool for teaching code. Thanks to Jeff Boichuk for sharing!