Last active
March 31, 2025 12:32
-
-
Save richcarl/d37c1ec7ebbbb149ed787249aa49def5 to your computer and use it in GitHub Desktop.
VSCode personal key bindings to use on top of Awesome Emacs Keymap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// my keybindings.json | |
[ | |
// start macro record with C-x ( | |
{ | |
"key": "ctrl+x shift+9", | |
"command": "kb-macro.startRecording", | |
"when": "!kb-macro.recording && config.keyboardMacro.recordingShortcuts == 'Option1'" | |
}, | |
{ | |
"key": "ctrl+alt+r", | |
"command": "-kb-macro.startRecording", | |
"when": "!kb-macro.recording && config.keyboardMacro.recordingShortcuts == 'Option1'" | |
}, | |
// end macro record with C-x ) | |
{ | |
"key": "ctrl+x shift+0", | |
"command": "kb-macro.finishRecording", | |
"when": "kb-macro.recording && config.keyboardMacro.recordingShortcuts == 'Option1'" | |
}, | |
{ | |
"key": "ctrl+alt+r", | |
"command": "-kb-macro.finishRecording", | |
"when": "kb-macro.recording && config.keyboardMacro.recordingShortcuts == 'Option1'" | |
}, | |
// playback macro with C-x e | |
{ | |
"key": "ctrl+x e", | |
"command": "kb-macro.playback", | |
"when": "!kb-macro.recording && config.keyboardMacro.recordingShortcuts == 'Option1'" | |
}, | |
{ | |
"key": "ctrl+alt+p", | |
"command": "-kb-macro.playback", | |
"when": "!kb-macro.recording && config.keyboardMacro.recordingShortcuts == 'Option1'" | |
}, | |
// cancel macro record with C-x e again | |
{ | |
"key": "ctrl+x e", | |
"command": "kb-macro.cancelRecording", | |
"when": "kb-macro.recording && config.keyboardMacro.recordingShortcuts == 'Option1'" | |
}, | |
{ | |
"key": "ctrl+alt+p", | |
"command": "-kb-macro.cancelRecording", | |
"when": "kb-macro.recording && config.keyboardMacro.recordingShortcuts == 'Option1'" | |
}, | |
// redo with C-S-/ (to match C-/ for undo) | |
{ | |
"key": "ctrl+shift+/", | |
"command": "redo" | |
}, | |
{ | |
"key": "shift+cmd+z", | |
"command": "-redo" | |
}, | |
// I like to use C-l to duplicate line instead of center | |
// but this is a personal thing | |
{ | |
"key": "ctrl+l", | |
"command": "editor.action.duplicateSelection" | |
}, | |
// I like to use Alt-Down/Up to add multiple cursors, and Shift-Alt-Down/Up to move lines | |
// (this causes fewer editing accidents) | |
{ | |
"key": "shift+alt+down", | |
"command": "editor.action.moveLinesDownAction", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "shift+alt+down", | |
"command": "-editor.action.insertCursorBelow", | |
"when": "editorTextFocus" | |
}, | |
{ | |
"key": "shift+alt+up", | |
"command": "editor.action.moveLinesUpAction", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "shift+alt+up", | |
"command": "-editor.action.insertCursorAbove", | |
"when": "editorTextFocus" | |
}, | |
{ | |
"key": "alt+down", | |
"command": "editor.action.insertCursorBelow", | |
"when": "editorTextFocus" | |
}, | |
{ | |
"key": "alt+down", | |
"command": "-editor.action.moveLinesDownAction", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "alt+up", | |
"command": "editor.action.insertCursorAbove", | |
"when": "editorTextFocus" | |
}, | |
{ | |
"key": "alt+up", | |
"command": "-editor.action.moveLinesUpAction", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
// Use M-. M-, M-? to navigate xref like in Emacs (important!) | |
{ | |
"key": "alt+.", | |
"command": "editor.action.revealDefinition", | |
"when": "editorHasDefinitionProvider && editorTextFocus" | |
}, | |
{ | |
"key": "alt+,", | |
"command": "workbench.action.navigateBack", | |
"when": "canNavigateBack" | |
}, | |
{ | |
"key": "shift+alt+/", | |
"command": "editor.action.goToReferences", | |
"when": "editorHasReferenceProvider && !inReferenceSearchEditor && !isInEmbeddedEditor" | |
}, | |
// personal preference for toggling Zen mode | |
{ | |
"key": "ctrl+k z", | |
"command": "-workbench.action.toggleZenMode", | |
"when": "!isAuxiliaryWindowFocusedContext" | |
}, | |
// make Shift+Arrows behave as Emacs windmove (super nice!) | |
{ | |
"key": "shift+down", | |
"command": "workbench.action.navigateDown" | |
}, | |
{ | |
"key": "shift+up", | |
"command": "workbench.action.navigateUp" | |
}, | |
{ | |
"key": "shift+left", | |
"command": "workbench.action.navigateLeft" | |
}, | |
{ | |
"key": "shift+right", | |
"command": "workbench.action.navigateRight" | |
}, | |
// use Ctrl-Shift-Arrow to change width/height of panes and terminal | |
{ | |
"key": "ctrl+shift+up", | |
"command": "workbench.action.increaseViewHeight", | |
"when": "!terminalFocus" | |
}, | |
{ | |
"key": "ctrl+shift+up", | |
"command": "workbench.action.terminal.resizePaneUp", | |
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" | |
}, | |
{ | |
"key": "ctrl+shift+down", | |
"command": "workbench.action.decreaseViewHeight", | |
"when": "!terminalFocus" | |
}, | |
{ | |
"key": "ctrl+shift+down", | |
"command": "workbench.action.terminal.resizePaneDown", | |
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" | |
}, | |
{ | |
"key": "ctrl+shift+left", | |
"command": "workbench.action.decreaseViewWidth", | |
"when": "!terminalFocus" | |
}, | |
{ | |
"key": "ctrl+shift+right", | |
"command": "workbench.action.increaseViewWidth", | |
"when": "!terminalFocus" | |
}, | |
// make C-h k open key bindings | |
{ | |
"key": "ctrl+k ctrl+s", | |
"command": "-workbench.action.openGlobalKeybindings" | |
}, | |
{ | |
"key": "ctrl+h", | |
"command": "-emacs-mcx.deleteBackwardChar", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "ctrl+h", | |
"command": "-editor.action.startFindReplaceAction", | |
"when": "editorFocus || editorIsOpen" | |
}, | |
{ | |
"key": "ctrl+h k", | |
"command": "workbench.action.openGlobalKeybindings" | |
}, | |
// allow C-x 3 to split terminal as well (new terminal is most useful) | |
{ | |
"key": "ctrl+x 3", | |
"command": "workbench.action.terminal.split", | |
"when": "terminalFocus && terminalProcessSupported || terminalFocus && terminalWebExtensionContributedProfile" | |
}, | |
// also close terminals with C-x k | |
{ | |
"key": "ctrl+x k", | |
"command": "workbench.action.terminal.kill", | |
"when": "terminalFocus" | |
}, | |
// do not allow C-w to accidentally kill your window | |
{ | |
"key": "ctrl+w", | |
"command": "-workbench.action.closeActiveEditor" | |
}, | |
{ | |
"key": "ctrl+w", | |
"command": "-workbench.action.closeGroup", | |
"when": "activeEditorGroupEmpty && multipleEditorGroups" | |
}, | |
{ | |
"key": "ctrl+w", | |
"command": "-workbench.action.terminal.killEditor", | |
"when": "terminalEditorFocus && terminalFocus && terminalHasBeenCreated || terminalEditorFocus && terminalFocus && terminalProcessSupported" | |
}, | |
// do not let C-S-w close the window | |
{ | |
"key": "ctrl+shift+w", | |
"command": "-workbench.action.closeWindow" | |
}, | |
// make C-< and C-> work as in Emacs | |
{ | |
"key": "ctrl+shift+.", | |
"command": "cursorBottom" | |
}, | |
{ | |
"key": "ctrl+shift+[Period]", | |
"command": "cursorBottom" | |
}, | |
{ | |
"key": "ctrl+shift+,", | |
"command": "cursorTop" | |
}, | |
{ | |
"key": "ctrl+shift+[Comma]", | |
"command": "cursorTop" | |
}, | |
// use M-g o for goto symbol, like consult-outline | |
{ | |
"key": "alt+g o", | |
"command": "workbench.action.gotoSymbol", | |
"when": "!accessibilityHelpIsShown && !accessibleViewIsShown" | |
}, | |
{ | |
"key": "ctrl+shift+o", | |
"command": "-workbench.action.gotoSymbol", | |
"when": "!accessibilityHelpIsShown && !accessibleViewIsShown" | |
}, | |
// use C-; for expanding select like er/expand-region | |
{ | |
"key": "ctrl+;", | |
"command": "editor.action.smartSelect.expand", | |
"when": "editorTextFocus" | |
}, | |
{ | |
"key": "shift+alt+right", | |
"command": "-editor.action.smartSelect.expand", | |
"when": "editorTextFocus" | |
}, | |
// use C-' to add matching multicursor (like mc/mark-all-dwim) | |
{ | |
"key": "ctrl+'", | |
"command": "editor.action.addSelectionToNextFindMatch", | |
"when": "editorFocus" | |
}, | |
{ | |
"key": "ctrl+d", | |
"command": "-editor.action.addSelectionToNextFindMatch", | |
"when": "editorFocus" | |
}, | |
{ | |
"key": "ctrl+'", | |
"command": "-editor.action.triggerSuggest", | |
"when": "editorTextFocus" | |
}, | |
{ | |
"key": "ctrl+'", | |
"command": "-toggleSuggestionDetails", | |
"when": "editorTextFocus && suggestWidgetVisible" | |
}, | |
// put quick text search on M-s g (like consult-ripgrep) | |
{ | |
"key": "alt+s g", | |
"command": "workbench.action.quickTextSearch", | |
"when": "!config.emacs-mcx.useMetaPrefixMacCmd" | |
}, | |
{ | |
"key": "alt+s o", | |
"command": "-workbench.action.quickTextSearch", | |
"when": "!config.emacs-mcx.useMetaPrefixMacCmd" | |
}, | |
{ | |
"key": "alt+s g", | |
"command": "workbench.action.quickTextSearch", | |
"when": "config.emacs-mcx.useMetaPrefixMacCmd" | |
}, | |
{ | |
"key": "alt+s o", | |
"command": "-workbench.action.quickTextSearch", | |
"when": "config.emacs-mcx.useMetaPrefixMacCmd" | |
}, | |
// use M-p M-n for isearch history | |
{ | |
"key": "alt+p", | |
"command": "history.showPrevious", | |
"when": "historyNavigationBackwardsEnabled && historyNavigationWidgetFocus && !isComposing && !suggestWidgetVisible" | |
}, | |
{ | |
"key": "alt+up", | |
"command": "-history.showPrevious", | |
"when": "historyNavigationBackwardsEnabled && historyNavigationWidgetFocus && !isComposing && !suggestWidgetVisible" | |
}, | |
{ | |
"key": "alt+n", | |
"command": "history.showNext", | |
"when": "historyNavigationForwardsEnabled && historyNavigationWidgetFocus && !isComposing && !suggestWidgetVisible" | |
}, | |
{ | |
"key": "alt+down", | |
"command": "-history.showNext", | |
"when": "historyNavigationForwardsEnabled && historyNavigationWidgetFocus && !isComposing && !suggestWidgetVisible" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment