How to move "~/.R/rstudio/keybindings" directory

I made a few new keyboard shortcuts, and they're saved in a really inconvenient spot at the highest-level directory in my documents folders in Windows. Normally I would just hide it, but I sync that folder with Google Drive and the .R folder comes up first in Google Drive now. I'm a neat freak and I hate clutter; how can I move the folder?

"Dotfiles" (or I guess it's a dot directory) like ~/.R are usually invisible, and exist for all sorts of programs on your computer, often containing things like user preferences (which is why I'm surprised the .R subdirectory is the only one you see). That same directory (for me at least) contains other user preference-type files, like snippets, themes, etc. So, I imagine a solution would need to generalize to all of those files in order for you to avoid having the entire directory show up.

I think all of these types of files are loaded together, but I'm not an IDE dev, so take this for the semi-guess that it is.

You can access this in the rstudioapi package:

In the source code for rstudio, I think this is where it's loaded:

Thanks for the reply. I'm pretty incompetent with R (I mostly get by looking up solutions and copy-pasting) so I'm not sure what to do with the information you've given. Are the bolded "function" and "source" supposed to be replaced with something? Does this code actually help me with moving the folder, or is it just showing me where they're located? If the latter, how would I go about relocating? (I've found answers for how to move a folder, but not for how to change where RStudio thinks the folder is.)

You can't move this folder in RStudio 1.2. As @mara discovered, the path is hardcoded in RStudio itself, so there's no way to use a different location.

However, we have made this path configurable in RStudio 1.3, which adds compliance to the XDG Base Directory Specification. So your keybindings will go into ~/.config/rstudio/keybindings, and you can pick a different folder by setting XDG_CONFIG_HOME.

RStudio 1.3 is not ready for day-to-day use, but you can try a daily build here if you're curious: https://dailies.rstudio.com/

2 Likes

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