Skip to contents

Locates or creates the Positron settings.json file on Windows or macOS, then ensures the "rstudio.keymap.enable": true setting is present to enable RStudio keyboard shortcuts. If the setting already exists and is true, no changes are made; otherwise, it is added or updated. set.binary argument determines if options(pkgType = 'binary') should be added to the .Rprofile.

Usage

set_positron_settings(home_dir = path.expand("~"), set.binary = TRUE)

Arguments

home_dir

Optional character string specifying the base directory to use as the user's home directory. Defaults to path.expand("~"). Useful for testing or custom setups.

set.binary

Logical, defaults to TRUE. If TRUE, runs set_binary_only_in_r_profile() after applying settings to configure binary options in the R profile.

Value

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.

Details

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.

Examples

if (FALSE) { # \dontrun{
  # Run the function with default settings
  set_positron_settings()
  # Run with a custom home directory and disable binary setting
  set_positron_settings(home_dir = tempdir(), set.binary = FALSE)
} # }