View source: R/set_positron_settings.R
set_positron_settings | R Documentation |
Locates or creates the Positron settings.json
file on Windows or macOS,
then updates those settings based on the provided configuration list.
Users can specify settings like RStudio keyboard shortcuts. The function can
also optionally configure binary package preferences in the .Rprofile
.
set_positron_settings(
home_dir = path.expand("~"),
set.binary = TRUE,
positron_settings = list()
)
home_dir |
Optional character string specifying the base directory to use
as the user's home directory. Defaults to |
set.binary |
Logical, defaults to |
positron_settings |
List of settings to apply. Can be structured as a list of
lists where each sub-list contains a setting name and value (e.g.,
|
This function uses the jsonlite
package to handle JSON operations and
creates the necessary directory structure if it doesn't exist. It is
designed to work cross-platform by detecting the operating system and
constructing the appropriate file path to Positron's user settings. The
function applies the settings provided in the positron_settings
parameter.
By default, no settings are changed unless explicitly specified.
Invisible NULL
. The function's purpose is its side effect: modifying
or creating the settings.json
file. It also prints messages to the console
indicating actions taken.
## Not run:
# Apply no settings changes, but ensure settings.json exists
set_positron_settings()
# Enable RStudio keyboard shortcuts using list of lists structure
set_positron_settings(
positron_settings = list(list("rstudio.keymap.enable", TRUE))
)
# Enable RStudio keyboard shortcuts using named list structure
set_positron_settings(
positron_settings = list("rstudio.keymap.enable" = TRUE)
)
# Apply multiple settings using named list
set_positron_settings(
positron_settings = list(
"rstudio.keymap.enable" = TRUE,
"editor.wordWrap" = "on"
)
)
# Apply settings with a custom home directory and disable binary setting
set_positron_settings(
home_dir = tempdir(),
set.binary = FALSE,
positron_settings = list("rstudio.keymap.enable" = TRUE)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.