2025年8月現在のvscodeショートカット設定

ちょくちょく変えるので定期的にさらしておく

[
    //-----------------------------------------------------------------
    // vimキーとVSCodeキーの選択
    //------------------------------------------------------------------
    // ctrl+ の機能メモ
    // a: vs(全選択) vim側で設定
    // b: vim(pageUp)
    // c: vs(コピー)
    // d: vs(同じ単語でマルチカーソル) -> vim仕様に変更
    // e: vim(下スクロール:下と同じ入力)
    // f: vim(pageDown)
    // g: original(カーソル下に拡張)
    // h: original(タブ移動)
    // i: vim(next jump)
    // j: vs(panel toggle)
    // k: vs(prefix)
    // l: original(タブ移動)
    // m: original(bookmarks prefix)
    // n: vs(newfile)
    // o: vim(prev jump:command)
    // p: vs(open file)
    // q: vs(quick menu)
    // r: vim(redo: paste register)
    // s: original(incriment)
    // t: original(editor<->terminal)
    // u: vim(半pageUp:delete from start)
    // v: vim(矩形選択)
    // w: vs(ウィンドウを閉じる)
    // x: vim(decriment)
    // y: vim(上scroll:上と同じ入力)
    // z: vs(Undo)
    // []: vs(indent)
    // ^: vsCode切り替え(by PowerToys)
    // -: Edge切り替え(by PowerToys)
    // \: ワークスペース切り替え
    // /: vs(comment)
    //-----------------------------------------------------------------------
    // ctrl+aは全選択にしたいのでctrl+sでインクリメントする(ctrl+sがないので使わないctrl+mのコマンドに割り当てる)
    {
        "key": "ctrl+m",
        "command": "-extension.vim_ctrl+m",
        "when": "editorTextFocus && vim.active && vim.use<C-m> && !inDebugRepl || vim.active && vim.use<C-m> && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use<C-m> && !inDebugRepl && vim.mode == 'SearchInProgressMode'"
    },
    {
        "key": "ctrl+s",
        "command": "extension.vim_ctrl+m",
        "when": "editorTextFocus && vim.active && vim.use<C-m> && !inDebugRepl"
    },
    // 癖で押してしまうためVSCode優先。
    {
        "key": "ctrl+c",
        "command": "-extension.vim_ctrl+c",
        "when": "editorTextFocus && vim.active && vim.overrideCtrlC && vim.use<C-c> && !inDebugRepl"
    },
    // カーソル拡張
    {
        "key": "ctrl+g",
        "command": "-workbench.action.gotoLine"
    },
    {
        "key": "ctrl+g",
        "command": "-extension.vim_ctrl+g",
        "when": "editorTextFocus && vim.active && vim.use<C-g> && !inDebugRepl"
    },
    {
        "key":"ctrl+g",
        "command":"editor.action.insertCursorBelow",
    },
    // 左右移動 (vimではノーマルモード時のみ移動にしたいのでsettingsで別設定)
    // {
    //     "key": "ctrl+h",
    //     "command": "-extension.vim_ctrl+h",
    //     "when": "editorTextFocus && vim.active && vim.use<C-h> && !inDebugRepl"
    // },
    {
        "key": "ctrl+h",
        "command": "workbench.action.previousEditorInGroup",
        "when": "!terminalFocus && vim.mode != 'Insert'&& activeWebviewPanelId != 'GitHub Copilot Suggestions'"
    },
    // {
    //     "key": "ctrl+l",
    //     "command": "-extension.vim_navigateCtrlL",
    //     "when": "editorTextFocus && vim.active && vim.use<C-l> && !inDebugRepl"
    // },
    {
        "key": "ctrl+l",
        "command": "workbench.action.nextEditorInGroup",
        "when": "!terminalFocus&& vim.mode != 'Insert' && activeWebviewPanelId != 'GitHub Copilot Suggestions'"
    },
    // Vimのctrl+jは不要
    {
        "key": "ctrl+j",
        "command": "-extension.vim_ctrl+j",
        "when": "editorTextFocus && vim.active && vim.use<C-j> && !inDebugRepl"
    },
    // vimのマルチバイト入力は捨てる
    {
        "key": "ctrl+k",
        "command": "-extension.vim_ctrl+k",
        "when": "editorTextFocus && vim.active && vim.use<C-k> && !inDebugRepl"
    },
    // VSCodeのタブ機能切替は事故のもとなので無効化しておく。vimも使わないので空き。
    {
        "key": "ctrl+m",
        "command": "-editor.action.toggleTabFocusMode"
    },
    // vimのctrl+nは使わない
    {
        "key": "ctrl+n",
        "command": "-extension.vim_ctrl+n",
        "when": "editorTextFocus && vim.active && vim.use<C-n> && !inDebugRepl || vim.active && vim.use<C-n> && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use<C-n> && !inDebugRepl && vim.mode == 'SearchInProgressMode'"
    },
    // vimのctrl+pは不要。
    {
        "key": "ctrl+p",
        "command": "-extension.vim_ctrl+p",
        "when": "suggestWidgetVisible && vim.active && vim.use<C-p> && !inDebugRepl || vim.active && vim.use<C-p> && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use<C-p> && !inDebugRepl && vim.mode == 'SearchInProgressMode'"
    },
    // vimのctrl+qはctrl+vと同じなのでVSCodeのクイックメニューを優先。
    {
        "key": "ctrl+q",
        "command": "-extension.vim_winCtrlQ",
        "when": "editorTextFocus && vim.active && vim.use<C-q> && !inDebugRepl"
    },
    // vimのctrl+tは使わないのでターミナルとの行き来用に変更
    {
        "key": "ctrl+t",
        "command": "-extension.vim_ctrl+t",
        "when": "editorTextFocus && vim.active && vim.use<C-t> && !inDebugRepl"
    },
    {
        "key": "ctrl+t",
        "command": "-workbench.action.showAllSymbols"
    },
    {
        "key": "ctrl+t",
        "command": "workbench.action.terminal.focus",
    },
    // vimのctrl+vは必須。(本来設定なしで優先されるはずだが、貼り付けが発動することあったので一応無効化)
    {
        "key": "ctrl+v",
        "command": "-editor.action.clipboardPasteAction"
    },
    // VSCodeのマルチカーソル機能優先。vimのg->bも同じ機能だが押しにくい。
    // {
    //     "key": "ctrl+d",
    //     "command": "-extension.vim_ctrl+d",
    //     "when": "editorTextFocus && vim.active && vim.use<C-d> && !inDebugRepl"
    // },
    // tabは選択範囲を維持して入れられるVSCodeショートカットの方をを有効化
    {
        "key": "ctrl+[",
        "command": "-extension.vim_ctrl+[",
        "when": "editorTextFocus && vim.active && vim.use<C-[> && !inDebugRepl"
    },
    {
        "key": "ctrl+]",
        "command": "-extension.vim_ctrl+]",
        "when": "editorTextFocus && vim.active && vim.use<C-]> && !inDebugRepl"
    },
    //-------------------------------------
    // ctrl+k + hlはペイン移動に割り当てる
    //-------------------------------------
    {
        "key": "shift+control+l",
        "command": "workbench.action.focusFirstEditorGroup",
        "when": "sideBarFocus"
    },
    {
        "key": "shift+ctrl+h",
        "command": "workbench.action.focusSideBar",
        "when": "!panelFocus && !sideBarFocus && activeEditorGroupIndex==1"
    },
    {
        "key": "shift+ctrl+h",
        "command": "workbench.action.focusLeftGroup",
        "when": "!panelFocus && !sideBarFocus&& activeEditorGroupIndex!=1"
    },
    {
        "key": "shift+ctrl+k",
        "command": "workbench.action.showCommands",
        "when": "!panelFocus"
    },
    {
        "key": "shift+ctrl+l",
        "command": "workbench.action.focusRightGroup",
        "when": "!panelFocus && !sideBarFocus"
    },
    {
        "key": "shift+ctrl+l",
        "command": "workbench.action.focusFirstEditorGroup",
        "when": "sideBarFocus"
    },
    {
        "key": "shift+ctrl+j",
        "command": "workbench.action.focusPanel",
        "when": "!panelFocus && !sideBarFocus"
    },
    {
        "key": "shift+ctrl+k",
        "command": "workbench.action.focusActiveEditorGroup",
        "when": "panelFocus "
    },
    {
        "key": "shift+ctrl+h",
        "command": "workbench.action.terminal.focusPreviousPane",
        "when": "terminalFocus"
    },
    {
        "key": "shift+ctrl+l",
        "command": "workbench.action.terminal.focusNextPane",
        "when": "terminalFocus"
    },
    //-------------------------------------
    // ctrl+jkでいろいろ上下移動
    //-------------------------------------
    // 候補のフォーカス
    {
        "key": "ctrl+j",
        "command": "selectNextSuggestion",
        "when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
    },
    {
        "key": "ctrl+k",
        "command": "selectPrevSuggestion",
        "when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
    },
    // ヒント
    {
        "key": "ctrl+j",
        "command": "showNextParameterHint",
        "when": "editorTextFocus && parameterHintsMultipleSignatures && parameterHintsVisible && textInputFocus"
    },
    {
        "key": "ctrl+k",
        "command": "showPrevParameterHint",
        "when": "editorTextFocus && parameterHintsMultipleSignatures && parameterHintsVisible && textInputFocus"
    },
    // quick fix (効かない?)
    {
        "key": "j",
        "command": "selectNextQuickFix",
        "when": "editorFocus && quickFixWidgetVisible"
    },
    {
        "key": "k",
        "command":"selectPreviousQuickFix",
        "when": "editorFocus && quickFixWidgetVisible"
    },
    // hover内
    {
        "key": "ctrl+j",
        "command": "editor.action.scrollDownHover",
        "when": "editorHoverFocused && editorHoverVisible"
    },
    {
        "key": "ctrl+k",
        "command": "editor.action.scrollUpHover",
        "when": "editorHoverFocused && editorHoverVisible"
    },

    // リスト
    {
        "key": "ctrl+j",
        "command": "list.focusDown",
        "when": "listFocus"
    },
    {
        "key": "ctrl+k",
        "command":"list.focusUp",
        "when": "listFocus"
    },
    // クイックオープン
    {
        "key": "ctrl+j",
        "command":"workbench.action.quickOpenSelectNext",
        "when": "inQuickOpen"
    },
    {
        "key": "ctrl+k",
        "command":"workbench.action.quickOpenSelectPrevious",
        "when": "inQuickOpen"
    },
    // 閉じるのはEscだとクイックメニュー時に都合悪いので別のキーvim的には左か右で閉じる感覚
    {
        "key": "ctrl+h",
        "command": "workbench.action.closeQuickOpen",
        "when": "inQuickOpen"
    },
    {
        "key": "ctrl+l",
        "command": "workbench.action.closeQuickOpen",
        "when": "inQuickOpen"
    },
    //-------------------------------
    // エクスプローラー explorer
    //-------------------------------
    // {
    //     "key": "l",
    //     "command": "workbench.action.focusActiveEditorGroup",
    //     "when": "explorerViewletFocus && explorerViewletVisible && !inputFocus"
    // },
    //新規ファイル作成
    {
        "key": "ctrl+h",
        "command": "workbench.action.previousSideBarView",
        "when": "sideBarFocus && sideBarVisible"
    },
    {
        "key": "ctrl+l",
        "command": "workbench.action.nextSideBarView",
        "when": "sideBarFocus && sideBarVisible"
    },
    //新規ファイル作成
    {
        "key": "n",
        "command": "explorer.newFile",
        "when": "explorerViewletFocus && explorerViewletVisible && !inputFocus"
    },
    //新規フォルダ作成
    {
        "key": "f",
        "command": "explorer.newFolder",
        "when": "explorerViewletFocus && explorerViewletVisible && !inputFocus"
    },
    //エクスプローラーでフォルダを開く
    {
        "key": "e",
        "command": "revealFileInOS",
        "when": "explorerViewletFocus && explorerViewletVisible && !inputFocus"
    },
    //リネーム
    {
        "key": "r",
        "command": "renameFile",
        "when": "explorerViewletFocus && explorerViewletVisible && !inputFocus"
    },
    //削除
    {
        "key": "d",
        "command": "deleteFile",
        "when": "explorerViewletFocus && explorerViewletVisible && !inputFocus"
    },
    //削除
    {
        "key": "g l",
        "command": "workbench.action.focusFirstEditorGroup",
        "when": "explorerViewletFocus && explorerViewletVisible && !inputFocus"
    },
    //-------------------------------
    // ターミナル
    // ctrl+ c, p, q, r は割り当てないように!
    //-------------------------------

    {
        "key": "ctrl+j",
        "command": "workbench.action.focusActiveEditorGroup",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+t",
        "command": "workbench.action.focusActiveEditorGroup",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+oem_plus",
        "command": "workbench.action.toggleMaximizedPanel",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+k",
        "command": "workbench.action.terminal.scrollUpPage",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+j",
        "command": "workbench.action.terminal.scrollDownPage",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+g",
        "command": "workbench.action.terminal.scrollUpPage",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+z",
        "command": "workbench.action.terminal.kill",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+h",
        "command": "workbench.action.terminal.focusPreviousPane",
        "when": "terminalFocus"
    },
    //------------------------------------------------
    // Bookmarks (ctrl+mをプレフィクスとして使う)
    // vimのマーク機能はファイル内一時マーク用
    //  Bookmarksはファイルまたいで長く使うマーク用
    //------------------------------------------------
    {
        "key": "ctrl+m ctrl+m",
        "command": "bookmarks.toggle",
        "when": "editorTextFocus"
    },
    // ラベル付きブックマーク
    {
        "key": "ctrl+m ctrl+n",
        "command":"bookmarks.toggleLabeled",
        "when": "editorTextFocus"
    },
    // リストから選ぶ ctrl押しっぱなしでm+kjだけで選択可
    {
        "key": "ctrl+m ctrl+j",
        "command":"bookmarks.listFromAllFiles",
    },
    {
        "key": "ctrl+m ctrl+k",
        "command":"bookmarks.listFromAllFiles",
    },
    // 次と前へ移動(defaultの表示の拡大縮小はいらないのでつぶす)
    {
        "key": "ctrl+oem_plus",
        "command":"bookmarks.jumpToNext",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+-",
        "command":"bookmarks.jumpToPrevious",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+m ctrl+i",
        "command":"bookmarks.list",
        "when": "editorTextFocus"
    },
    // マーク位置を選択
    {
        "key": "ctrl+m ctrl+o",
        "command": "bookmarks.selectLines",
        "when": "editorTextFocus",
    },
    // ファイル内全削除
    {
        "key": "ctrl+m c",
        "command":"bookmarks.clear"
    },
    //------------------------------------------------
    // git hub copilot
    // 主にパネルが表示されてるときのショートカット
    //------------------------------------------------
    {
        "key": "ctrl+e",
        "command":"workbench.action.focusLastEditorGroup",
        "when":"github.copilot.activated && github.copilot.panelVisible && activeWebviewPanelId == 'GitHub Copilot Suggestions'"
    },
    //==============================================================
    // shift+tabをsetting.jsonでvimに割り当てるために
    {
        "key": "shift+tab",
        "command": "extension.vim_ctrl+p",
        "when": "vim.active && vim.use<C-p>",
    },
    {
        "key": "ctrl+1",
        "command": "extension.vim_ctrl+d",
        "when": "editorTextFocus && vim.active && vim.use<C-d> && vim.mode=='Insert'"
    },
    {
        "key": "shift+tab",
        "command": "-insertPrevSuggestion",
        "when": "hasOtherSuggestions && textInputFocus && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'"
    },
    {
        "key": "ctrl+oem_102",
        "command": "vscodeWorkspaceSwitcher.openWorkspace"
    },
    {
        "key": "ctrl+k w",
        "command": "-vscodeWorkspaceSwitcher.openWorkspace"
    },
    {
        "key": "ctrl+q",
        "command": "workbench.action.quickOpenView",
        "when": "!terminalFocus"
    },
    {
        "key": "ctrl+q",
        "command": "-workbench.action.quickOpenView"
    },
    {
        "key": "ctrl+p",
        "command": "workbench.action.quickOpen",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+p",
        "command": "-workbench.action.quickOpen"
    },
    {
        "key": "ctrl+w",
        "command": "-extension.vim_ctrl+w",
        "when": "editorTextFocus && vim.active && vim.use<C-w> && !inDebugRepl"
    },
    {
        "key": "ctrl+oem_4",
        "command": "-editor.action.outdentLines",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+oem_6",
        "command": "-editor.action.indentLines",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+oem_4",
        "command": "inlineChat.start",
        "when": "editorFocus && inlineChatHasProvider && !editorReadonly"
    },
    {
        "key": "ctrl+i",
        "command": "-inlineChat.start",
        "when": "editorFocus && inlineChatHasProvider && !editorReadonly"
    },
    {
        "key": "ctrl+oem_4",
        "command": "workbench.action.terminal.chat.start",
        "when": "terminalChatAgentRegistered && terminalFocusInAny && terminalHasBeenCreated || terminalChatAgentRegistered && terminalFocusInAny && terminalProcessSupported"
    },
    {
        "key": "ctrl+i",
        "command": "-workbench.action.terminal.chat.start",
        "when": "terminalChatAgentRegistered && terminalFocusInAny && terminalHasBeenCreated || terminalChatAgentRegistered && terminalFocusInAny && terminalProcessSupported"
    },
    {
        "key": "ctrl+oem_4",
        "command": "workbench.action.terminal.chat.focusInput",
        "when": "terminalChatFocus && !inlineChatFocused"
    },
    {
        "key": "ctrl+i",
        "command": "-workbench.action.terminal.chat.focusInput",
        "when": "terminalChatFocus && !inlineChatFocused"
    },
    {
        "key": "ctrl+oem_4",
        "command": "workbench.action.chat.startVoiceChat",
        "when": "chatIsEnabled && hasSpeechProvider && inChatInput && !chatSessionRequestInProgress && !editorFocus && !notebookEditorFocused && !scopedVoiceChatGettingReady && !speechToTextInProgress && !terminalChatActiveRequest || chatIsEnabled && hasSpeechProvider && inlineChatFocused && !chatSessionRequestInProgress && !editorFocus && !notebookEditorFocused && !scopedVoiceChatGettingReady && !speechToTextInProgress && !terminalChatActiveRequest"
    },
    {
        "key": "ctrl+i",
        "command": "-workbench.action.chat.startVoiceChat",
        "when": "chatIsEnabled && hasSpeechProvider && inChatInput && !chatSessionRequestInProgress && !editorFocus && !notebookEditorFocused && !scopedVoiceChatGettingReady && !speechToTextInProgress && !terminalChatActiveRequest || chatIsEnabled && hasSpeechProvider && inlineChatFocused && !chatSessionRequestInProgress && !editorFocus && !notebookEditorFocused && !scopedVoiceChatGettingReady && !speechToTextInProgress && !terminalChatActiveRequest"
    },
    {
        "key": "ctrl+oem_4",
        "command": "workbench.action.chat.stopListeningAndSubmit",
        "when": "inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'editor' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'inline' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'quick' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'terminal' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'view' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'editor' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'inline' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'quick' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'terminal' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'view'"
    },
    {
        "key": "ctrl+i",
        "command": "-workbench.action.chat.stopListeningAndSubmit",
        "when": "inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'editor' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'inline' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'quick' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'terminal' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'view' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'editor' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'inline' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'quick' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'terminal' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'view'"
    },
    {
        "key": "ctrl+j",
        "command": "workbench.action.togglePanel",
        "when": "!editorHoverFocused && !quickInputVisible && !searchViewletVisible && !terminalFocus && !terminalFindWidgetFocus && !terminalFocusInFindWidget"
    },
    {
        "key": "ctrl+k ctrl+l",
        "command": "-editor.toggleFold",
        "when": "editorTextFocus && foldingEnabled"
    },
    {
        "key": "ctrl+shift+d",
        "command": "-workbench.view.debug",
        "when": "viewContainer.workbench.view.debug.enabled"
    },
    {
        "key": "ctrl+shift+d",
        "command": "addCursorsAtSearchResults",
        "when": "fileMatchOrMatchFocus && searchViewletVisible"
    },
    {
        "key": "ctrl+shift+l",
        "command": "-addCursorsAtSearchResults",
        "when": "fileMatchOrMatchFocus && searchViewletVisible"
    },
    {
        "key": "ctrl+shift+d",
        "command": "editor.action.selectHighlights",
        "when": "editorFocus"
    },
    {
        "key": "ctrl+shift+l",
        "command": "-editor.action.selectHighlights",
        "when": "editorFocus"
    },
    {
        "key": "ctrl+shift+d",
        "command": "notebook.selectAllFindMatches",
        "when": "config.notebook.multiCursor.enabled && notebookFindWidgetFocused || config.notebook.multiCursor.enabled && notebookCellEditorFocused && activeEditor == 'workbench.editor.notebook'"
    },
    {
        "key": "ctrl+shift+l",
        "command": "-notebook.selectAllFindMatches",
        "when": "config.notebook.multiCursor.enabled && notebookFindWidgetFocused || config.notebook.multiCursor.enabled && notebookCellEditorFocused && activeEditor == 'workbench.editor.notebook'"
    },
    {
        "key": "ctrl+shift+d",
        "command": "selectAllSearchEditorMatches",
        "when": "inSearchEditor"
    },
    {
        "key": "ctrl+shift+l",
        "command": "-selectAllSearchEditorMatches",
        "when": "inSearchEditor"
    },
    {
        "key": "ctrl+shift+k",
        "command": "-editor.action.deleteLines",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+j",
        "command": "-workbench.action.search.toggleQueryDetails",
        "when": "inSearchEditor || searchViewletFocus"
    },
    {
        "key": "ctrl+j",
        "command": "-workbench.action.togglePanel"
    }
]

vscode

Posted by gran-gran-gran