Custom Number-Pad Shortcuts for Pane Management - my favorite RStudio Tip

Note. The proposed good-practice can be (best) used when an external keyboard is available – whether on PC or Mac.

It is often useful to zoom the pane of interest at any point of time when working with RStudio. (Sometimes you may want to have two panes zoomed in like both Source and Console on the top of each other.) Happily, there are keyboard shortcuts that allow the user to zoom different panes. They are typically of the form CTRL+SHIFT+X where X is a number between 1-9. It is helpful to have these keyboard shortcuts, but frequently pressing three keys simultaneously is not too easy of a job. It would have been nice if there could be a way to zoom different panes just by pressing just one button. The problem, however, is that many keyboard buttons are already reserved for more important tasks.

Here is where the main trick falls in: Customizing the keyboard shortcuts using the buttons in the numpad (in PC) or number pad (in Mac). As you may already know, RStudio allows one to customize the keyboard shortcuts to any key or combinations of keys they want. Happily, the buttons in the number pad keys are treated as independent buttons in the RStudio system (and possibly other systems) when they are NOT in the number mode.

What I ended up doing was replacing many shortcuts of the form CTRL+SHIFT+X by the single number X on the number pad. For example:

  • 0 on the number pad now shows "all panes"
  • 1 on the number pad now zooms "Source"
  • 2 on the number pad now zooms "Console"
  • and so on.

The above ides of keeping the underlying integer numbers the same helps to remember the shortcuts more easily and also makes it straightforward to switch back to the original shortcuts if needed.

I hope you enjoy the above-suggested good-practice if you had not come up with it yourself already.

5 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.