Reputation: 1940
I was wondering how could I set a shortcut, for example CRTL+F for the keystrokes <-
for a better experience programming with R language. Or even when I type -
it prints out on my coding scripts the full <-
.
I could set it in RStudio but couldn't find a way to do that in VS code. The shortcut options in VS Code are always linked to IDE commands, didn't help me at all.
Any ideas?
Upvotes: 1
Views: 374
Reputation: 57686
You can also define a user snippet. For example, put this in your snippets\r.json
file:
"assign": {
"prefix": "=",
"body": " <- ",
"description": "left arrow assignment"
}
Now, typing =Tab will insert <-
.
Upvotes: 1
Reputation: 28663
Or use this handy keyboard shortcut example with arguments from the doc pages
{
"key": "ctrl+f",
"command": "type",
"args": { "text": "<-" },
"when": "editorTextFocus && editorLangId == r"
},
Upvotes: 2
Reputation: 1940
Got it just by adding the below code to keybinding.json
file:
// Place your key bindings in this file to override the defaults
[
{
"key": "oem_minus oem_minus",
"command": "type",
"args": {
"text": "<-"
},
"when": "editorTextFocus"
}
]
Worked perfectly. When I type --
it prints out <-
.
Upvotes: 0