Shortcut for Reflow Comment on macOS

Hey!

The shortcut for reflow comment command+shift+/ in RStudio 1.2.1335 on macOS Mojave 10.14.6 is not working for me, and instead is opening the search on the help menu.

Anyway to fix it?

Hi @lpuerto!

What I think is happening here is that there is a system-level keyboard shortcut that is overriding RStudio's app-specific shortcuts. I'm not sure when this started, but it predates Mojave — I see the same thing on macOS 10.13 High Sierra.

If you never use the system-level shortcut, then you might want to turn it off or change it to something else by going to:

  • System Preferences > Keyboard > Shortcuts > App Shortcuts

    (Screenshot from High Sierra. Hopefully it's not too different on Mojave! :sweat_smile: )

The other option of course would be to change RStudio's shortcut to something else (via Tools > Modify Keyboard Shortcuts…).

Thanks!

I was looking for something like you are showing me, but I couldn't find it and I didn't think it was a system wide shortcut for help since in other apps like sublime text it was doing something else instead of search in the help.

Anyhow, I think something is going on. I remove the shortcut for help in macOS settings, but then that shortcut did nothing. I have to remap it to command+shift+7 to make it work. I have a Spanish keyboard layout, and the / is on the 7 key pressing shift, but RStudio is mapping it as command+shift+7 instead of command+shift+/.

Weird

Hmm, I'm not sure if there's a system for translating keyboard shortcuts to other keyboard layouts?

For the USA layout, / is typed without using Shift (the Shift modifier for that key produces the ?). If I try to set an RStudio shortcut using a symbol that has to be typed using Shift, I have to include Shift in the shortcut, and the shortcut is always shown as involving Shift + the non-shift symbol on the same key.

For example, say I want to set a shortcut involving the &, which on my layout shares a key with the 7. I can create a shortcut that's Command + 7, or a shortcut that's Command + Shift + 7 (which I guess could also be thought of as "Command + &"), but there's no way to make Command + & show up as the keyboard shortcut setting.

What's your default RStudio shortcut for "Block Indent"? That would seem to be a parallel case, since the default on my system (Ctrl + ]) involves a symbol (the ]) that can be typed without modifiers with a USA keyboard layout but not with a Spanish (ISO) keyboard layout.

(If I switch my keyboard layout to Spanish, I can't use the Block Indent shortcut anymore: Ctrl + + doesn't work, and neither does Ctrl + Alt + +).

I see…

The only think here is, if I remap the shortcut in RStudio, then it doesn't change in the RStudio interface:

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