Skip to content

Instantly share code, notes, and snippets.

@stephenturner
Created November 18, 2022 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stephenturner/56791a70249218126c5d19ba75d729e4 to your computer and use it in GitHub Desktop.
Save stephenturner/56791a70249218126c5d19ba75d729e4 to your computer and use it in GitHub Desktop.
// Place your key bindings in this file to overwrite the defaults
[
// RStudio: Copy lines up/down with alt+cmd+up/down
{
"key": "alt+cmd+down",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "alt+cmd+up",
"command": "editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+up",
"command": "-editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
// RStudio: Insert cursors above and below with ctrl-alt+up/down
{
"key": "ctrl+alt+down",
"command": "editor.action.insertCursorBelow",
"when": "editorTextFocus"
},
{
"key": "alt+cmd+down",
"command": "-editor.action.insertCursorBelow",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+up",
"command": "editor.action.insertCursorAbove",
"when": "editorTextFocus"
},
{
"key": "alt+cmd+up",
"command": "-editor.action.insertCursorAbove",
"when": "editorTextFocus"
},
// RStudio: Delete lines cmd-d
{
"key": "cmd+d",
"command": "editor.action.deleteLines",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+cmd+k",
"command": "-editor.action.deleteLines",
"when": "editorTextFocus && !editorReadonly"
},
// The above remapping destroyed the find next shortcut.
// Replace it with alt+d and shift-alt+d to get them all
{
"key": "alt+d",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "cmd+d",
"command": "-editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "shift+alt+d",
"command": "editor.action.selectHighlights",
"when": "editorFocus"
},
{
"key": "shift+cmd+l",
"command": "-editor.action.selectHighlights",
"when": "editorFocus"
},
// Run current line in a terminal
{
"key": "cmd+enter",
"command": "workbench.action.terminal.runSelectedText"
},
// RStudio-like cmd+1 to focus on editor, cmd+2 to focus on terminal
{
"key": "ctrl+1",
"command": "workbench.action.focusActiveEditorGroup"
},
{
"key": "ctrl+2",
"command": "workbench.action.terminal.focus"
},
// Make tab switching more like a web browser
// Use ctrl+alt(+shift)+tab to replace the default behavior.
{
"key": "ctrl+tab",
"command": "workbench.action.nextEditor"
},
{
"key": "ctrl+shift+tab",
"command": "workbench.action.previousEditor"
},
{
"key": "ctrl+alt+tab",
"command": "workbench.action.openNextRecentlyUsedEditorInGroup"
},
{
"key": "ctrl+tab",
"command": "-workbench.action.openNextRecentlyUsedEditorInGroup"
},
{
"key": "ctrl+shift+alt+tab",
"command": "workbench.action.openPreviousRecentlyUsedEditorInGroup"
},
{
"key": "ctrl+shift+tab",
"command": "-workbench.action.openPreviousRecentlyUsedEditorInGroup"
},
{
"key": "ctrl+alt+tab",
"command": "workbench.action.quickOpenNavigateNext",
"when": "inQuickOpen"
},
{
"key": "ctrl+tab",
"command": "-workbench.action.quickOpenNavigateNext",
"when": "inQuickOpen"
},
{
"key": "ctrl+shift+alt+tab",
"command": "workbench.action.quickOpenNavigatePrevious",
"when": "inQuickOpen"
},
{
"key": "ctrl+shift+tab",
"command": "-workbench.action.quickOpenNavigatePrevious",
"when": "inQuickOpen"
},
// Pandoc render defaults to CMD-K, P as activation chord.
// This overwrites the default to copy the path of the active file.
// Change it to CMD-K, CMD-P, which is so far unset.
{
"key": "cmd+k cmd+p",
"command": "pandoc.render",
"when": "editorTextFocus && editorLangId == 'markdown'"
},
{
"key": "cmd+k p",
"command": "-pandoc.render",
"when": "editorTextFocus && editorLangId == 'markdown'"
},
{
"key": "cmd+l",
"command": "expandLineSelection",
"when": "editorTextFocus"
},
{
"key": "cmd+i",
"command": "-expandLineSelection",
"when": "editorTextFocus"
},
{
"key": "cmd+m",
"command": "-markdown.extension.editing.toggleMath",
"when": "editorTextFocus && !editorReadonly && editorLangId == 'markdown'"
},
{
"key": "cmd+h",
"command": "-testing.toggleTestingPeekHistory",
"when": "testing.isPeekVisible"
},
{
"key": "shift+cmd+c",
"command": "editor.action.commentLine",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "cmd+/",
"command": "-editor.action.commentLine",
"when": "editorTextFocus && !editorReadonly"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment