make_path_norm: Normalize Path Add-in

View source: R/add_ins.R

make_path_normR Documentation

Normalize Path Add-in

Description

Wrapper to execute fs::path_norm() as a shortcut on highlighted text. The updated text will be converted in place to a path normalized for the environment currently in use. For instance, \ or \\ will be converted to / on Windows machines. See below for process of setting shortcut.

Usage

make_path_norm()

Details

Add keyboard shortcut for make_path_norm() in RStudio, use the use_rstudio_keyboard_shortcut() function. Do add it manually, follow the instructions below.

  • Install rstudio.prefs, and restart RStudio

  • Select "Tools" –> "Modify Keyboard Shortcuts...".

  • In Search box, type "Make Path Normal".

  • Click in the "Shortcut" column on the "Make Path Normal" row.

  • Press intended shortcut keys (suggested: Ctrl+Shift+/) to set shortcut.

  • NOTE: It is possible to override a previously specified key combination with this selection.

Value

normalized path string

See Also

fs::path_norm

Examples

if (interactive()) {
  # set a keyboard shortcut for path normalization
  rstudio.prefs::use_rstudio_keyboard_shortcut(
    "Ctrl+Shift+/" = "rstudio.prefs::make_path_norm"
  )
}

rstudio.prefs documentation built on July 16, 2022, 5:07 p.m.