Skip to content

Instantly share code, notes, and snippets.

@kevinjamescasey
Last active January 17, 2025 17:40
Show Gist options
  • Save kevinjamescasey/41f2f3c7f40093546f40cc37e93acc7f to your computer and use it in GitHub Desktop.
Save kevinjamescasey/41f2f3c7f40093546f40cc37e93acc7f to your computer and use it in GitHub Desktop.
VSCode config
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+space f",
"command": "workbench.action.quickOpen"
},
{
"comment": "change gotoLine so its default keybinding can be used for other things"
},
{
"key": "alt+cmd+g",
"command": "workbench.action.gotoLine"
},
{
"key": "ctrl+g",
"command": "-workbench.action.gotoLine"
},
{ "comment": "these are selecting between point and mark" },
{
"key": "ctrl+m",
"command": "editor.action.setSelectionAnchor",
"when": "textInputFocus && !selectionAnchorSet"
},
{
"key": "ctrl+m",
"command": "editor.action.selectFromAnchorToCursor",
"when": "textInputFocus && selectionAnchorSet"
},
{
"key": "ctrl+a",
"when": "textInputFocus && selectionAnchorSet",
"command": "cursorLineStartSelect"
},
{
"key": "ctrl+e",
"when": "textInputFocus && selectionAnchorSet",
"command": "cursorLineEndSelect"
},
{
"key": "ctrl+f",
"when": "textInputFocus && selectionAnchorSet",
"command": "cursorRightSelect"
},
{
"key": "ctrl+b",
"when": "textInputFocus && selectionAnchorSet",
"command": "cursorLeftSelect"
},
{
"key": "ctrl+n",
"when": "textInputFocus && selectionAnchorSet",
"command": "cursorDownSelect"
},
{
"key": "ctrl+p",
"when": "textInputFocus && selectionAnchorSet",
"command": "cursorUpSelect"
},
{
"key": "ctrl+,",
"when": "textInputFocus && selectionAnchorSet",
"command": "cursorTopSelect"
},
{
"key": "ctrl+.",
"when": "textInputFocus && selectionAnchorSet",
"command": "cursorBottomSelect"
},
{
"key": "ctrl+g",
"command": "editor.action.cancelSelectionAnchor",
"when": "editorTextFocus && selectionAnchorSet"
},
{
"key": "ctrl+g",
"command": "cancelSelection",
"when": "editorHasSelection && textInputFocus"
},
{ "comment": "close the quickopen pallete" },
{
"key": "ctrl+g",
"command": "workbench.action.closeQuickOpen",
"when": "inQuickOpen"
},
{ "comment": "not sure which operations are cancellable" },
{
"key": "ctrl+g",
"command": "editor.cancelOperation",
"when": "cancellableOperation"
},
{ "comment": "cancel multi-cursor" },
{
"key": "ctrl+g",
"command": "removeSecondaryCursors",
"when": "editorHasMultipleSelections && textInputFocus"
},
{ "comment": "close find in page bar" },
{
"key": "ctrl+g",
"command": "closeFindWidget",
"when": "editorFocus && findWidgetVisible && !isComposing"
},
{ "comment": "search buffer like Emacs" },
{
"key": "ctrl+s",
"command": "actions.find",
"when": "editorFocus || editorIsOpen"
},
{
"key": "ctrl+s",
"command": "editor.action.nextMatchFindAction",
"when": "editorFocus && findInputFocussed"
},
{
"key": "ctrl+r",
"command": "editor.action.previousMatchFindAction",
"when": "editorFocus"
},
{ "comment": "switch buffer" },
{
"key": "ctrl+space b",
"command": "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
"when": "!activeEditorGroupEmpty"
},
{ "comment": "close other buffers" },
{
"key": "ctrl+space 1",
"command": "runCommands",
"args": {
"commands": [
"workbench.action.closeOtherEditors",
"workbench.action.closeEditorsInOtherGroups"
]
}
},
{ "comment": "expand and shrink selection" },
{
"key": "ctrl+;",
"command": "editor.action.smartSelect.expand",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+;",
"command": "editor.action.smartSelect.shrink",
"when": "editorTextFocus"
},
{ "comment": "copy selection" },
{
"key": "ctrl+'",
"command": "editor.action.clipboardCopyAction"
},
{ "comment": "paste clipboard" },
{
"key": "ctrl+y",
"command": "editor.action.clipboardPasteAction"
},
{ "comment": "cut selection clipboard" },
{
"key": "ctrl+w",
"command": "editor.action.clipboardCutAction"
},
{ "comment": "switch to next pane" },
{
"key": "ctrl+o",
"command": "workbench.action.focusNextGroup"
},
{
"key": "ctrl+space ctrl+o",
"command": "workbench.action.focusNextGroup"
},
{
"key": "ctrl+space o",
"command": "workbench.action.focusPreviousGroup"
},
{ "comment": "top or bottom of buffer" },
{
"key": "ctrl+,",
"command": "cursorTop",
"when": "textInputFocus && !selectionAnchorSet"
},
{
"key": "ctrl+.",
"command": "cursorBottom",
"when": "textInputFocus && !selectionAnchorSet"
},
{
"key": "ctrl+space r",
"command": "revealInExplorer"
},
{
"key": "ctrl+/",
"command": "undo"
},
{
"key": "ctrl+shift+/",
"command": "redo"
},
{ "comment": "cancel the intellisense popup" },
{
"key": "ctrl+g",
"command": "hideSuggestWidget",
"when": "suggestWidgetVisible && textInputFocus"
},
{ "comment": "switch to other window" },
{
"key": "ctrl+space ctrl+w",
"command": "workbench.action.switchWindow"
},
{
"key": "ctrl+w",
"command": "-workbench.action.switchWindow"
},
{ "comment": "open command selection instead of the default file selection" },
{
"key": "cmd+p",
"command": "workbench.action.showCommands"
},
{
"comment": "open command selection. try to limit when it works so other uses like Jupyter notebooks can still use key combo"
},
{
"key": "ctrl+enter",
"command": "workbench.action.showCommands",
"when": "editorTextFocus && !notebookEditorFocused"
},
{
"key": "ctrl+space e",
"command": "workbench.action.terminal.runSelectedText"
}
]
{
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment