usethis icon indicating copy to clipboard operation
usethis copied to clipboard

Feature: `use_rstudio_keyboard_shorcuts()`

Open DanChaltiel opened this issue 11 months ago • 2 comments

Hi,

I use usethis a lot when I'm setting RStudio on a new computer, especially with use_rstudio_preferences() which saves a lot of time.

RStudio also provides a way to save and load Keyboard Shortcuts, but remembering the path is difficult and system dependant.

It would be far more convenient if there was a function that could do it for ourselves, either like use_rstudio_preferences() or like edit_rstudio_prefs().

Would you consider implementing this in usethis?

DanChaltiel avatar Jan 22 '25 09:01 DanChaltiel

I'm ambivalent about adding such a function, because it feels weird to me to edit this JSON file "by hand" as it were. But it is sort of comparable to use_rstudio_preferences(), so I won't necessarily close this.

Sidebar: In case it's interesting to you in the meantime, the way I handle all of this is to give these sort of RStudio config files my "full dotfile treatment". I keep all my dotfiles in a git repo and symlink them into the right locations. So here's how ~/.config is actually set up for me:

 .config -> /Users/jenny/resources/system-setup/dotfiles/.config

and then rstudio directory within that .config directory looks like so:

~/.config % tree rstudio
rstudio
├── crash-handler.conf
├── dictionaries
│   └── custom
├── keybindings
│   ├── addins.json
│   ├── editor_bindings.json
│   └── rstudio_bindings.json
├── rstudio-prefs.json
└── snippets
    └── r.snippets

When I set up a new computer, all my dotfiles just come over with my main file migration and then I place a few symlinks to put them all back into force.

jennybc avatar Jan 31 '25 21:01 jennybc

Thank you so much for this workaround Jenny, this is a very interesting setup. Unfortunately, I have to use Windows so symlinking is not easy to set up, but maybe I can save/read these in a portable archive.

I'm curious though, why does it feel weird to you to edit rstudio_bindings.json but not rstudio-prefs.json?

DanChaltiel avatar Feb 01 '25 09:02 DanChaltiel

@DanChaltiel - I use GNU-stow for my Windows dotfiles just as I do UNIX dotfiles and it works fine. That being said, you could look into Link Shell Extension for a nice little context menu utility to manage symlinks and more.

jimbrig avatar Aug 03 '25 17:08 jimbrig

I do think this is now out of scope for usethis as we turn out limited developer time to supporting positron.

hadley avatar Aug 11 '25 12:08 hadley