问题
I would like to export/import RStudio global options, which can typically found and set in RStudio at Tools> Global Options...
Ideally I could run a line of code, saving the existing settings to a file. Then run another line of code to load those settings from this file.
These options include settings such as a Dark Theme for the GUI, or Tab Width etc.
This has a range of uses but my specific use case is that I spin up virtual environments to utilize cloud computing. Each time I shutdown and/or spin-up a new environment I need to apply these various settings anew (or work with the defaults).
After searching for a while all I have found is this unanswered user request. Despite the unanswered request, I feel like there is/should be an existing way to do this, even if imperfect.
Thanks in advance for any help/direction
回答1:
Aha! I found a relevant support page: https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State
TL;DR:
Most settings are stored in a "RStudio-Desktop" folder. To be exact:
- Windows: %localappdata%\RStudio-Desktop
(fyi: %localappdata% usually resolves to C:\Users\{username}\AppData\Local [1]) - Unix / MacOS: ~/.rstudio-desktop
I have confirmed that deleting/overriding that folder with a backup of it restores the settings from the time of the backup.
Some further information (e.g. last window size) may be stored at
- Windows: %appdata%\RStudio
- Unix: ~/.config/RStudio
(I'm guessing it's the same for MacOS, but the relevant section is worded it bit weirdly, so I'm unsure.)
来源:https://stackoverflow.com/questions/50750866/rstudio-global-settings-options-export-import