Skip to content

Instantly share code, notes, and snippets.

@stephenturner
Created May 31, 2017 21:04
Show Gist options
  • Save stephenturner/8ab9452a09ac8ed4e4421d1e1bc70b55 to your computer and use it in GitHub Desktop.
Save stephenturner/8ab9452a09ac8ed4e4421d1e1bc70b55 to your computer and use it in GitHub Desktop.
VSCode keybindings to replicate my most commonly used RStudio shortcuts (Mac)
// 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"
},
// 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"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment