Skip to content

Instantly share code, notes, and snippets.

@francisbarton
Last active April 29, 2023 22:48
Show Gist options
  • Save francisbarton/adc256e0a4155c5ceac620d3d8026a64 to your computer and use it in GitHub Desktop.
Save francisbarton/adc256e0a4155c5ceac620d3d8026a64 to your computer and use it in GitHub Desktop.
My VSCode custom keyboard shortcuts
[
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+shift+k",
"command": "-editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
// Shift + Alt + Up/Down to copy lines
{
"key": "shift+alt+down",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+up",
"command": "editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+alt+up",
"command": "-editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
// Ctrl + Up/Down to move lines
{
"key": "ctrl+up",
"command": "editor.action.moveLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "alt+up",
"command": "-editor.action.moveLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+down",
"command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "alt+down",
"command": "-editor.action.moveLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
// Ctrl + Alt + / to find next and add
{
"key": "ctrl+alt+/",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "ctrl+d",
"command": "-editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
// R help with F1
{
"key": "f1",
"command": "r.helpPanel.openForSelection"
},
{
"key": "f1",
"command": "-workbench.action.showCommands"
},
// R package functions
{
"key": "ctrl+shift+l",
"command": "r.loadAll"
},
{
"key": "ctrl+shift+b",
"command": "r.build"
},
{
"key": "ctrl+shift+e",
"command": "r.check"
},
{
"key": "ctrl+shift+d",
"command": "r.document"
},
{
"key": "ctrl+shift+d",
"command": "-workbench.view.debug",
"when": "viewContainer.workbench.view.debug.enabled"
},
{
"key": "ctrl+shift+t",
"command": "r.test"
},
// R shortcuts to add left assignment arrow <-
{
"key": "Alt+Left",
"command": "type",
"args": { "text": " <-" },
"when": "editorTextFocus && editorLangId =~ /r|rmd|qmd/"
},
{
"key": "Alt+Left",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": " <-" },
"when": "terminalFocus"
},
// Ctrl + Shift + F to find in all project files
{
"key": "ctrl+shift+f",
"command": "workbench.action.replaceInFiles"
},
{
"key": "ctrl+shift+h",
"command": "-workbench.action.replaceInFiles"
},
// Ctrl + Alt + Up/Down to add new cursor above/below
{
"key": "ctrl+alt+up",
"command": "editor.action.insertCursorAbove",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+up",
"command": "-editor.action.insertCursorAbove",
"when": "editorTextFocus"
},
{
"key": "shift+alt+up",
"command": "-editor.action.insertCursorAbove",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+down",
"command": "editor.action.insertCursorBelow",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+down",
"command": "-editor.action.insertCursorBelow",
"when": "editorTextFocus"
},
{
"key": "shift+alt+down",
"command": "-editor.action.insertCursorBelow",
"when": "editorTextFocus"
},
// Ctrl + Alt + c inserts new chunk in Rmd/Qmd
{
"key": "ctrl+alt+c",
"command": "editor.action.insertSnippet",
"when": "editorLangId =~ /r|rmd|qmd/ && editorTextFocus",
"args": {
"snippet": "```{r}\n$0\n```"
}
},
// Include Quarto in Knit command
{
"key": "ctrl+shift+k",
"command": "r.knitRmd",
"when": "editorTextFocus && editorLangId =~ /rmd|qmd/"
},
{
"key": "ctrl+shift+k",
"command": "-r.knitRmd",
"when": "editorTextFocus && editorLangId == 'rmd'"
},
// Ctrl + Shift + ` creates an R terminal
{
"key": "ctrl+`",
"command": "r.createRTerm"
},
// Ctrl + Alt + # toggles between terminal and editor focus
{
"key": "ctrl+alt+[Backslash]",
"command": "workbench.action.terminal.focus",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+[Backslash]",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment