Skip to content

Commit 839d568

Browse files
committed
Add keybindings
1 parent 271f9c9 commit 839d568

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.vscode/keybindings.json

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Directly taken from:
2+
// https://github.com/REditorSupport/vscode-R/wiki/Keyboard-shortcuts#suggested-keyboard-shortcuts
3+
[
4+
{
5+
"key": "alt+-",
6+
"command": "type",
7+
"when": "editorLangId == r && editorTextFocus || editorLangId == rmd && editorTextFocus",
8+
// if you want using quarto, try this
9+
// "when": "editorLangId =~ /r|rmd|qmd/ && editorTextFocus",
10+
"args": {"text": " <- "}
11+
},
12+
{
13+
"key": "ctrl+shift+m",
14+
"command": "type",
15+
"when": "editorLangId == r && editorTextFocus || editorLangId == rmd && editorTextFocus",
16+
"args": {"text": " %>% "}
17+
},
18+
{
19+
"key": "ctrl+shift+m",
20+
"command": "-workbench.actions.view.problems"
21+
},
22+
23+
// input indicative of r markdown code chunk
24+
{
25+
"key": "ctrl+shift+i",
26+
"command": "editor.action.insertSnippet",
27+
"when": "editorTextFocus && editorLangId == 'rmd'",
28+
"args": {
29+
"snippet": "```{r}\n${TM_SELECTED_TEXT}$0\n```"
30+
},
31+
"label": "input indicative of r markdown code chunk"
32+
},
33+
34+
// you can also input indicative of code chunk in `r` file by inserting "# %% ":
35+
// specifics in `https://github.com/REditorSupport/vscode-R/pull/662`
36+
{
37+
"key": "ctrl+shift+i",
38+
"command": "editor.action.insertSnippet",
39+
"when": "editorTextFocus && editorLangId == 'r'",
40+
"args": {
41+
"snippet": "$LINE_COMMENT %% "
42+
},
43+
"label": "input indicative of code chunk"
44+
},
45+
46+
// open help panel for selection
47+
{
48+
"key": "f1",
49+
"command": "r.helpPanel.openForSelection",
50+
"when": "editorTextFocus && editorLangId == 'r' || editorTextFocus && editorLangId == 'rmd'"
51+
},
52+
53+
// read yaml header parameters into `params` when editing an Rmarkdown file
54+
{
55+
"key": "ctrl+shift+p",
56+
"command": "r.runCommandWithEditorPath",
57+
"args": "params <- rmarkdown::yaml_front_matter(\"$$\")$params |> lapply(\\(x) if (is.list(x)) x$value else x)",
58+
"when": "editorTextFocus && editorLangId == 'rmd'"
59+
},
60+
61+
// RStudio keybinding for R Package development
62+
{
63+
"key": "ctrl+shift+b",
64+
"command": "r.install",
65+
"when": "resourceLangId == 'r'"
66+
},
67+
{
68+
"key": "ctrl+shift+e",
69+
"command": "r.check",
70+
"when": "resourceLangId == 'r'"
71+
},
72+
{
73+
"key": "ctrl+shift+t",
74+
"command": "r.test",
75+
"when": "resourceLangId == 'r'"
76+
},
77+
{
78+
"key": "ctrl+shift+d",
79+
"command": "r.document",
80+
"when": "resourceLangId == 'r'"
81+
},
82+
{
83+
"key": "ctrl+shift+l",
84+
"command": "r.loadAll",
85+
"when": "resourceLangId == 'r'"
86+
},
87+
{
88+
"key": "ctrl+alt+p",
89+
"command": "r.runCommand",
90+
"when": "editorTextFocus && editorLangId == 'r'",
91+
"args": ".vsc.browser(httpgd::hgd_url(), viewer = \"Beside\")"
92+
}
93+
]

0 commit comments

Comments
 (0)