Search code examples
macoskeyboard-shortcutsrstudio

RStudio for Mac: "Move Focus to Source" shortcut doesn't work (?)


The "Move Focus to Source" Shortcut (Ctrl1) doesn't seem to be working--either it does nothing or, when RStudio is in full-screen mode, it (annoyingly) acts as if I had just pressed Ctrl+Left Arrow) (However, manually clicking on "Move Focus to Source" does work as expected).

This post suggests that it might be a bug. However, in contrast to the post, the other shortcuts involving control+numeral (Such as "Show History") appear to be working correctly.

So is this a bug or am I doing something wrong?
Also, since--as mentioned in the post--the RStudio guys "don't recommend overriding [the keyboard shortcuts] via the Mac System Preferences", I'd prefer to avoid that approach (though I'm not exactly sure why it should be avoided--hopefully someone can shed some light on this, too).

Set-up:
OS X Version 10.9.3
RStudio Version 0.98.501


Solution

  • By default, Apple sets the Ctrl1 shortcut to "Switch to Desktop 1". As a result, if you want to enable the Ctrl1 behavior in RStudio you will first have to disable this shortcut in the System Preferences.

    Specifically, the path is:

    System Preferences --> Keyboard --> Mission Control --> Switch to Desktop 1 
    

    Then, after disabling this, RStudio's shortcut will work just fine.

    [Note: you could either reassign the RStudio shortcut or the "Switch to Desktop 1" shortcut but the approach I described is definitely the most reliable since you won't have to worry about any other shortcut conflicts.]