Keyboard shortcut in R / radian terminal

94 Views Asked by At

I have a keyboard shortcut to use ALT+- to insert -> in R files, and it works.

{
        "key": "alt+-",
        "command": "type",
        "when": "editorLangId == r || editorLangId == rmd || editorLangId == quarto && editorTextFocus",
        "args": {
            "text": " <- "
        }
    }

But it does not (unsurprisingly) work in the R / radian terminal because of the when condition.

How can I make it also work in the R / radian terminal?

1

There are 1 best solutions below

0
Rizqi Ramadhan On

Based on the radian's documentation, the key binding for inserting -> is by using esc + - whether you accessed radian through VScode or directly in the terminal.

You can custom them also in your .radian_profile or radian/profile using the code below

  options(
    radian.escape_key_map = list(
        list(key = "-", value = " <- ")
    ),
    radian.ctrl_key_map = list(
        list(key = "right", value = " %>% ")
    )
  )