Bring ctrl+R back

I've been used to run code using shortcut ctrl+R for many years. I found that you changed this shortcut to history of commands. I understand the reason that you want to make as similar to other consoles as possible. But it would be nice to have at least an option to set the shortcut back to running a code. Setting it in keyboard shortcuts doesn't work.

2 Likes

I've managed to add the shortcut in rstudio_bindings.json as "executeCode" : "Ctrl+Enter|Ctrl+R".

Jan,

I am also trying to do this - could you be more explicit about where the rstudio_bindings.json file is / or where I create it please.

thanks

R version 3.4.2
RStudio Version 1.1.383
Windows 7

my related SO question

David,

See the last section of this Rstudio support page. Make sure to enable viewing hidden folders and files on your pc.

https://support.rstudio.com/hc/en-us/articles/206382178-Customizing-Keyboard-Shortcuts?mobile_site=true

You can change it in keyboard shortcuts. But to do that you also have to remove Ctrl+Enter as an alternate shortcut. For some reason the keyboard shortcuts menu doesn't work properly when two shortcuts are entered.

A bug?

Thanks Jan.

I have no .R directory (I have enabled hidden files / folders) - am I meant to create this, and the subsequent directory / file structure) ?

Edit: I have tried creating the nested file structure with the json file but it didnt update the shortcuts.

Thanks Lalush. That's def an option, however, I would like if I could back back to using either though.

Actually, if you edit it in the JSON you will get two lines in shortcuts. Then you can change those lines to whatever you want and have two shortcuts forever.

ugh... Sorry sorry. Yes , it works, thanks for your help. (i had managed to save the file as .json.txt instead of .json) thanks again.

no worries :slight_smile:

to sum up:

  • the json file can be found (on windows) in C:\Users\[username]\Documents\.R\rstudio\keybindings
  • edit file rstudio_bindings.json to {"executeCode" : "Ctrl+Enter|Ctrl+R"} (if you have some shortcuts already in that json then try to keep them as well)
  • you can edit both shortcuts in RStudio now
3 Likes