[ // // =========================================================================== // MARK: Command Palette // =========================================================================== // { // Show commands. "key": "ctrl+x m", "command": "workbench.action.showCommands" }, { // Show commands. "key": "ctrl+x ctrl+m", "command": "workbench.action.showCommands" }, { // Show commands. "key": "ctrl+x enter", "command": "workbench.action.showCommands" }, { // Show commands. "key": "alt+x", "command": "workbench.action.showCommands" }, // // =========================================================================== // MARK: Window // =========================================================================== // { // Reset zoom. "key": "cmd+0", "command": "workbench.action.zoomReset" }, // // =========================================================================== // MARK: Window Tabs // =========================================================================== // { // Go to next window tab. "key": "ctrl+z ctrl+n", "command": "workbench.action.showNextWindowTab" }, { // Go to next window tab. // // This is a workaround for ctrl+n not working globally as down arrow in // all input fields. This relies on Karabiner-Elements to remap ctrl+n to // down arrow. "key": "ctrl+z down", "command": "workbench.action.showNextWindowTab" }, { // Go to next window tab. "key": "shift+cmd+]", "command": "workbench.action.showNextWindowTab" }, { // Go to previous window tab. "key": "ctrl+z ctrl+p", "command": "workbench.action.showPreviousWindowTab" }, { // Go to previous window tab. "key": "shift+cmd+[", "command": "workbench.action.showPreviousWindowTab" }, { // Create new window tab. "key": "ctrl+z ctrl+c", "command": "workbench.action.newWindowTab" }, { // Merge all window tabs. "key": "ctrl+z ctrl+j", "command": "workbench.action.mergeAllWindowTabs" }, { // Move window tab to new window. "key": "ctrl+z ctrl+t", "command": "workbench.action.moveWindowTabToNewWindow" }, { // Toggle window tabs bar. "key": "ctrl+z ctrl+z", "command": "workbench.action.toggleWindowTabsBar" }, { "key": "ctrl+z ctrl+k", "command": "workbench.action.closeWindow" }, // // =========================================================================== // MARK: Save // =========================================================================== // { // Save file. "key": "ctrl+x ctrl+s", "command": "workbench.action.files.save" }, // // =========================================================================== // MARK: File open // =========================================================================== // { // Open file via file browser extension. "key": "ctrl+x ctrl+f", "command": "file-browser.open", "when": "editorTextFocus" }, { // Open quick open. "key": "ctrl+x ctrl+;", "command": "workbench.action.quickOpen" }, // // =========================================================================== // MARK: File rename // =========================================================================== // { // Rename file via file browser extension. "key": "ctrl+c r", "command": "file-browser.rename" }, // // =========================================================================== // MARK: Switch and close editor // =========================================================================== // { // Show all editors by most recently used. "key": "ctrl+x ctrl+b", "command": "workbench.action.showAllEditorsByMostRecentlyUsed", "when": "!terminalFocus" }, { // Close active editor. "key": "ctrl+x ctrl+k", "command": "workbench.action.closeActiveEditor", "when": "!terminalFocus" }, // // =========================================================================== // MARK: Fullscreen // =========================================================================== // { // Toggle fullscreen. "key": "ctrl+cmd+enter", "command": "workbench.action.toggleFullScreen", "when": "!isIOS" }, { // Toggle fullscreen. "key": "cmd+enter", "command": "workbench.action.toggleFullScreen", "when": "!isIOS" }, { // Disable default toggle fullscreen keybinding. "key": "ctrl+cmd+f", "command": "-workbench.action.toggleFullScreen", "when": "!isIOS" }, // // =========================================================================== // MARK: Editor Navigation // =========================================================================== // { // Go to next editor. "key": "cmd+]", "command": "workbench.action.nextEditor", "when": "!(terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus)" }, { // Go to previous editor. "key": "cmd+[", "command": "workbench.action.previousEditor", "when": "!(terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus)" }, { // Focus next terminal. "key": "cmd+]", "command": "workbench.action.terminal.focusNext", "when": "terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus" }, { // Focus previous terminal. "key": "cmd+[", "command": "workbench.action.terminal.focusPrevious", "when": "terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus" }, // // =========================================================================== // MARK: Editor Group Navigation // =========================================================================== // { // Focus next editor group. "key": "ctrl+x ctrl+o", "command": "workbench.action.focusNextGroup", "when": "!terminalFocus" }, { // Focus previous editor group. "key": "ctrl+x ctrl+i", "command": "workbench.action.focusPreviousGroup", "when": "!terminalFocus" }, { // Navigate up. "key": "alt+i", "command": "workbench.action.navigateUp" }, { // Navigate up. // // Workaround for alt+i not working in VSCode. Relies on Karabiner-Elements // to remap alt+i to cmd+alt+up. "key": "cmd+alt+up", "command": "workbench.action.navigateUp" }, { // Navigate right. "key": "alt+l", "command": "workbench.action.navigateRight" }, { // Navigate left. "key": "alt+j", "command": "workbench.action.navigateLeft" }, { // Navigate down. "key": "alt+k", "command": "workbench.action.navigateDown" }, // // =========================================================================== // MARK: Editor group layout // =========================================================================== // { // Even editor widths. "key": "ctrl+x space", "command": "workbench.action.evenEditorWidths", "when": "!terminalFocus" }, { "key": "ctrl+z ctrl+enter", "command": "workbench.action.toggleMaximizeEditorGroup", "when": "editorPartMaximizedEditorGroup || editorPartMultipleEditorGroups" }, { "key": "ctrl+z enter", "command": "workbench.action.minimizeOtherEditors", "when": "editorPartMaximizedEditorGroup || editorPartMultipleEditorGroups" }, // // =========================================================================== // MARK: Move active editor group // =========================================================================== // { // Move active editor group up. "key": "ctrl+shift+i", "command": "workbench.action.moveActiveEditorGroupUp" }, { // Move active editor group down. "key": "ctrl+shift+k", "command": "workbench.action.moveActiveEditorGroupDown" }, { // Move active editor group left. "key": "ctrl+shift+j", "command": "workbench.action.moveActiveEditorGroupLeft" }, { // Move active editor group right. "key": "ctrl+shift+l", "command": "workbench.action.moveActiveEditorGroupRight" }, // // =========================================================================== // MARK: Move active editor into group // =========================================================================== // { // Move active editor into group above. "key": "alt+shift+i", "command": "workbench.action.moveEditorToAboveGroup" }, { // Move active editor into group above. // // Workaround for alt+i not working in VSCode. Relies on Karabiner-Elements // to remap alt+i to cmd+alt+up. "key": "cmd+alt+shift+up", "command": "workbench.action.moveEditorToAboveGroup" }, { // Move active editor into group below. "key": "alt+shift+k", "command": "workbench.action.moveEditorToBelowGroup" }, { // Move active editor into group left. "key": "alt+shift+j", "command": "workbench.action.moveEditorToLeftGroup" }, { // Move active editor into group right. "key": "alt+shift+l", "command": "workbench.action.moveEditorToRightGroup" }, // // =========================================================================== // MARK: Undo/redo // =========================================================================== // { // Undo. "key": "alt+-", "command": "undo" }, { // Redo. "key": "alt+shift+-", "command": "redo" }, // // =========================================================================== // MARK: Scrolling // =========================================================================== // { // Scroll half page down. "key": "ctrl+v", "command": "editorScroll", "args": { "to": "down", "by": "halfPage", "revealCursor": true, "value": 1 }, "when": "editorTextFocus && !suggestWidgetVisible" }, { // Scroll half page up. "key": "alt+v", "command": "editorScroll", "args": { "to": "up", "by": "halfPage", "revealCursor": true, "value": 1 }, "when": "editorTextFocus && !suggestWidgetVisible" }, { // Disable awesome-emacs-keymap scroll down keybinding. "key": "ctrl+v", "command": "-emacs-mcx.scrollUpCommand", "when": "editorTextFocus && !suggestWidgetVisible" }, { // Disable awesome-emacs-keymap scroll up keybinding. "key": "alt+v", "command": "-emacs-mcx.scrollDownCommand", "when": "editorTextFocus && !config.emacs-mcx.useMetaPrefixMacCmd && !suggestWidgetVisible" }, // // =========================================================================== // MARK: Suggestions // =========================================================================== // { // Trigger suggestions. "key": "ctrl+/", "command": "editor.action.triggerSuggest", "when": "editorTextFocus" }, { // Toggle suggestion details. "key": "ctrl+/", "command": "toggleSuggestionDetails", "when": "editorTextFocus && suggestWidgetVisible" }, // // =========================================================================== // MARK: Text navigation // =========================================================================== // { // Forward paragraph. "key": "alt+e", "command": "emacs-mcx.forwardParagraph", "when": "editorTextFocus && !suggestWidgetVisible" }, { // Forward paragraph. // // This is a workaround for alt+e not working in VSCode. Relies on // Karabiner-Elements to remap alt+e to cmd+alt+right. "key": "cmd+alt+right", "command": "emacs-mcx.forwardParagraph", "when": "editorTextFocus && !suggestWidgetVisible" }, { // Backward paragraph. "key": "alt+a", "command": "emacs-mcx.backwardParagraph", "when": "editorTextFocus && !suggestWidgetVisible" }, { // Go to symbol definition. "key": "ctrl+t", "command": "workbench.action.gotoSymbol", "when": "editorTextFocus" }, { // Jump to definition. "key": "ctrl+c ctrl+j", "command": "editor.action.revealDefinition" }, { // Navigate back. "key": "alt+g b", "command": "workbench.action.navigateBack" }, { // Navigate back. "key": "alt+g alt+b", "command": "workbench.action.navigateBack" }, { // Peek symbol references. "key": "alt+shift+/", "command": "editor.action.referenceSearch.trigger", "when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor" }, // // =========================================================================== // MARK: Text manipulation // =========================================================================== // { // Set indentation to correct level. // // This was borrowed from the awesome-emacs-keymap extension and modifed to // add the `!cpp.shouldAcceptTab` condition for the sake of Cursor. // // Extension: https://marketplace.visualstudio.com/items?itemName=tuttieee.emacs-mcx "key": "tab", "command": "emacs-mcx.tabToTabStop", "when": "editorTextFocus && !editorReadonly && !inlineSuggestionVisible && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible && !inSnippetMode && !editorTabCompletion && !editorParameterHintsVisible && !cursorAtInlineEdit && !cpp.shouldAcceptTab" }, { // Cycle spacing. // // This is a basic emulation Emacs' built-in cycle-spacing command. It // doesn't actually cycle spacing, but it performs the first step which is // to replace all spacing surrounding the cursor with a single space. "key": "alt+space", "command": "macros.cycleSpacing", "when": "editorTextFocus && !editorReadonly" }, { // Toggle quotes. // // Extension: https://marketplace.visualstudio.com/items?itemName=BriteSnow.vscode-toggle-quotes "key": "ctrl+'", "command": "editor.togglequotes", "when": "editorTextFocus && !editorReadonly" }, { // Comment line. "key": "ctrl+c /", "command": "editor.action.commentLine", "when": "editorTextFocus && !editorReadonly" }, { // Comment line. "key": "ctrl+c ctrl+/", "command": "editor.action.commentLine", "when": "editorTextFocus && !editorReadonly" }, { // Format document. "key": "ctrl+c ctrl+f", "command": "editor.action.formatDocument", "when": "editorTextFocus && !editorReadonly" }, { // Duplicate selection. "key": "ctrl+x ctrl+d", "command": "editor.action.duplicateSelection" }, { // Duplicate selection. // // This is a workaround for ctrl+d not working globally as forward delete in // all input fields. This relies on Karabiner-Elements to remap ctrl+d to // forward delete. "key": "ctrl+x delete", "command": "editor.action.duplicateSelection" }, { // Rename thing at point. "key": "ctrl+c ctrl+.", "command": "editor.action.rename", "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly" }, { // Indent line "key": "ctrl+c ]", "command": "editor.action.indentLines", "when": "editorTextFocus && !editorReadonly" }, { // Indent line "key": "alt+]", "command": "editor.action.indentLines", "when": "editorTextFocus && !editorReadonly" }, { // Outdent line "key": "ctrl+c [", "command": "editor.action.outdentLines", "when": "editorTextFocus && !editorReadonly" }, { // Outdent line "key": "alt+[", "command": "editor.action.outdentLines", "when": "editorTextFocus && !editorReadonly" }, { // Move lines up in editor. "key": "alt+p", "command": "editor.action.moveLinesUpAction", "when": "editorTextFocus && !editorReadonly" }, { // Move lines down in editor. "key": "alt+n", "command": "editor.action.moveLinesDownAction", "when": "editorTextFocus && !editorReadonly" }, { // Move lines down in editor. // // This is a workaround for alt+n not working in VSCode. Relies on // Karabiner-Elements to remap alt+n to cmd+alt+down. "key": "cmd+alt+down", "command": "editor.action.moveLinesDownAction", "when": "editorTextFocus && !editorReadonly" }, { // Move cell up in notebook editor. "key": "alt+p", "command": "notebook.cell.moveUp", "when": "notebookEditorFocused && !inputFocus" }, { // Move cell down in notebook editor. "key": "alt+n", "command": "notebook.cell.moveDown", "when": "notebookEditorFocused && !inputFocus" }, { // Move cell down in notebook editor. // // This is a workaround for alt+n not working in VSCode. Relies on // Karabiner-Elements to remap alt+n to cmd+alt+down. "key": "cmd+alt+down", "command": "notebook.cell.moveDown", "when": "notebookEditorFocused && !inputFocus" }, // // =========================================================================== // MARK: Expand region // =========================================================================== // Extension: // - https://marketplace.visualstudio.com/items?itemName=letrieu.expand-region // { // Expand selection. "key": "alt+.", "command": "expand_region", "when": "editorTextFocus" }, { // Shrink/contract selection. "key": "alt+,", "command": "undo_expand_region", "when": "editorHasSelection && editorTextFocus" }, // // =========================================================================== // MARK: Multi-cursor // =========================================================================== // { // Select all highlights. "key": "shift+cmd+a", "command": "editor.action.selectHighlights", "when": "editorFocus" }, { // Disable default insert cursor above keybinding. "key": "alt+cmd+up", "command": "-editor.action.insertCursorAbove", "when": "editorTextFocus" }, { // Insert cursor above. "key": "alt+m", "command": "editor.action.insertCursorAbove", "when": "editorTextFocus && !editorHasSelection" }, { // Add selection to previous find match when editor has selection. "key": "alt+m", "command": "emacs-mcx.addSelectionToPreviousFindMatch", "when": "editorTextFocus && editorHasSelection" }, { // Disable default insert cursor below keybinding. "key": "alt+cmd+down", "command": "-editor.action.insertCursorBelow", "when": "editorTextFocus" }, { // Insert cursor below when editor has no selection. "key": "alt+/", "command": "editor.action.insertCursorBelow", "when": "editorTextFocus && !editorHasSelection" }, { // Add selection to next find match when editor has selection. "key": "alt+/", "command": "emacs-mcx.addSelectionToNextFindMatch", "when": "editorTextFocus && editorHasSelection" }, // // =========================================================================== // MARK: Completion // =========================================================================== // { "key": "alt+shift+f", "command": "editor.action.inlineSuggest.acceptNextWord" }, // // =========================================================================== // MARK: Testing // =========================================================================== // { // Run current file. "key": "ctrl+c , v", "command": "macros.runTestCurrentFile", "when": "editorTextFocus" }, { // Run with coverage for current file. "key": "ctrl+c , ctrl+v", "command": "macros.runTestCoverageCurrentFile", "when": "editorTextFocus" }, { // Run at cursor. "key": "ctrl+c , s", "command": "macros.runTestAtCursor", "when": "editorTextFocus" }, { // Run with coverage at cursor. "key": "ctrl+c , ctrl+s", "command": "macros.runTestCoverageAtCursor", "when": "editorTextFocus" }, { // Run all tests. "key": "ctrl+c , a", "command": "macros.runTestAll", "when": "editorTextFocus" }, { // Run with coverage for all tests. "key": "ctrl+c , ctrl+a", "command": "macros.runTestCoverageAll", "when": "editorTextFocus" }, { // Re-run last run. "key": "ctrl+c , l", "command": "macros.runTestReRunLastRun", "when": "editorTextFocus" }, { // Re-run with coverage for last run. "key": "ctrl+c , ctrl+l", "command": "macros.runTestCoverageLastRun", "when": "editorTextFocus" }, { // Re-run failed tests. "key": "ctrl+c , f", "command": "macros.runTestReRunFailTests", "when": "editorTextFocus" }, { // Debug failed tests. "key": "ctrl+c , ctrl+f", "command": "macros.runTestDebugFailTests", "when": "editorTextFocus" }, { // Debug last run. "key": "ctrl+c , d", "command": "macros.runTestDebugLastRun", "when": "editorTextFocus" }, // // =========================================================================== // MARK: Documentation // =========================================================================== // { // Show documentation for symbol at cursor. "key": "ctrl+c d", "command": "editor.action.showHover" }, { // Show documentation for symbol at cursor. "key": "ctrl+c ctrl+d", "command": "editor.action.triggerParameterHints" }, { // Show documentation for symbol at cursor. // // This is a workaround for ctrl+d not working globally as forward delete in // all input fields. Hence we rebind ctrl+d to forward delete, meaning any // keybindings that use ctrl+d need to be updated to use delete aswell. "key": "ctrl+c delete", "command": "editor.action.triggerParameterHints" }, // // =========================================================================== // MARK: edamagit // =========================================================================== // Extension URL: // - https://marketplace.visualstudio.com/items?itemName=kahole.magit // { // Open magit status. "key": "ctrl+x g", "command": "magit.status" }, { // Disable default open magit status keybinding. "key": "alt+x g", "command": "-magit.status" }, // // =========================================================================== // MARK: GitHub // =========================================================================== // Extensions: // - https://marketplace.visualstudio.com/items?itemName=GitHub.remotehub // - https://marketplace.visualstudio.com/items?itemName=github.vscode-github-actions // - https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github // - https://marketplace.visualstudio.com/items?itemName=ziyasal.vscode-open-in-github // { "key": "ctrl+c g", "command": "extension.openInGitHub" }, // // =========================================================================== // MARK: Project Manager // =========================================================================== // Extension URL: // - https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager // { // List projects. "key": "ctrl+z ctrl+s", "command": "projectManager.listProjects" }, { // Disable default list projects keybinding. "key": "alt+cmd+p", "command": "-projectManager.listProjects" }, { "key": "ctrl+z ctrl+;", "command": "projectManager.listProjectsNewWindow", }, // // =========================================================================== // MARK: dired // =========================================================================== // Extension URL: // - https://marketplace.visualstudio.com/items?itemName=rrudi.vscode-dired // { // Open dired. "key": "ctrl+x ctrl+j", "command": "extension.dired.open", "when": "editorTextFocus && !inDebugRepl" }, { // Disable default open dired keybinding. "key": "ctrl+x f", "command": "-extension.dired.open", "when": "editorTextFocus && !inDebugRepl" }, { // Create directory. "key": "c", "command": "extension.dired.createDir", "when": "dired.open && !findWidgetVisible && !inQuickOpen" }, { // Disable default create directory keybinding. "key": "shift+=", "command": "-extension.dired.createDir", "when": "dired.open && !findWidgetVisible && !inQuickOpen" }, { // Go up directory. "key": "ctrl+l", "command": "extension.dired.goUpDir", "when": "dired.open && !findWidgetVisible && !inQuickOpen" }, { // Disable default go up directory keybinding. "key": "shift+b", "command": "-extension.dired.goUpDir", "when": "dired.open && !findWidgetVisible && !inQuickOpen" }, // // =========================================================================== // MARK: swiper // =========================================================================== // Extension URL: // - https://marketplace.visualstudio.com/items?itemName=wenhoujx.swiper // { // Swiper word at cursor. "key": "alt+r", "command": "swiper.swiper-word-at-cursor" }, // // =========================================================================== // MARK: Makefile task runner // =========================================================================== // Extension URL: // - https://marketplace.visualstudio.com/items?itemName=carlos-algms.make-task-provider // { // Run target. "key": "ctrl+c enter", "command": "make-task-provider.runTarget" } ]