預設鍵盤快速鍵參考
VS Code 隨附一組預設鍵盤快速鍵。本文列出了 VS Code 中常見的預設鍵盤快速鍵。
若要查看完整的鍵盤快速鍵清單,請在 VS Code 中使用以下任一選項:
- 在命令面板中選擇 Preferences: Open Default Keyboard Shortcuts (JSON) (偏好設定:開啟預設鍵盤快速鍵 (JSON))。
- 開啟鍵盤快速鍵編輯器,然後在更多動作 (...) 選單中選擇 Show System Keybindings (顯示系統快速鍵)。
注意
下列按鍵是以標準美式鍵盤配置為基準。取得關於使用不同 鍵盤配置 的詳細資訊。
基本編輯
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 剪下整行 (未選取內容時) | ⌘X (Windows, Linux Ctrl+X) | editor.action.clipboardCutAction |
| 複製整行 (未選取內容時) | ⌘C (Windows, Linux Ctrl+C) | editor.action.clipboardCopyAction |
| 貼上 | ⌘V (Windows, Linux Ctrl+V) | editor.action.clipboardPasteAction |
| 刪除整行 | ⇧⌘K (Windows, Linux Ctrl+Shift+K) | editor.action.deleteLines |
| 在下方插入一行 | ⌘Enter (Windows, Linux Ctrl+Enter) | editor.action.insertLineAfter |
| 在上方插入一行 | ⇧⌘Enter (Windows, Linux Ctrl+Shift+Enter) | editor.action.insertLineBefore |
| 將整行向下移動 | ⌥↓ (Windows, Linux Alt+Down) | editor.action.moveLinesDownAction |
| 將整行向上移動 | ⌥↑ (Windows, Linux Alt+Up) | editor.action.moveLinesUpAction |
| 向下複製整行 | ⇧⌥↓ (Windows Shift+Alt+Down, Linux Ctrl+Shift+Alt+Down) | editor.action.copyLinesDownAction |
| 向上複製整行 | ⇧⌥↑ (Windows Shift+Alt+Up, Linux Ctrl+Shift+Alt+Up) | editor.action.copyLinesUpAction |
| 復原 | ⌘Z (Windows, Linux Ctrl+Z) | undo |
| 取消復原 (重做) | ⇧⌘Z (Windows, Linux Ctrl+Y) | redo |
| 將選取範圍新增至下一個搜尋符合項 | ⌘D (Windows, Linux Ctrl+D) | editor.action.addSelectionToNextFindMatch |
| 將最後一個選取範圍移動至下一個搜尋符合項 | ⌘K ⌘D (Windows, Linux Ctrl+K Ctrl+D) | editor.action.moveSelectionToNextFindMatch |
| 復原上一次游標操作 | ⌘U (Windows, Linux Ctrl+U) | cursorUndo |
| 在每個已選取行的結尾插入游標 | ⇧⌥I (Windows, Linux Shift+Alt+I) | editor.action.insertCursorAtEndOfEachLineSelected |
| 選取目前選取範圍的所有出現項 | ⇧⌘L (Windows, Linux Ctrl+Shift+L) | editor.action.selectHighlights |
| 選取目前字詞的所有出現項 | ⌘F2 (Windows, Linux Ctrl+F2) | editor.action.changeAll |
| 選取目前整行 | ⌘L (Windows, Linux Ctrl+L) | expandLineSelection |
| 在下方插入游標 | ⌥⌘↓ (Windows Ctrl+Alt+Down, Linux Shift+Alt+Down) | editor.action.insertCursorBelow |
| 在上方插入游標 | ⌥⌘↑ (Windows Ctrl+Alt+Up, Linux Shift+Alt+Up) | editor.action.insertCursorAbove |
| 跳至對應的括號 | ⇧⌘\ (Windows, Linux Ctrl+Shift+\) | editor.action.jumpToBracket |
| 增加縮排 | ⌘] (Windows, Linux Ctrl+]) | editor.action.indentLines |
| 減少縮排 | ⌘[ (Windows, Linux Ctrl+[) | editor.action.outdentLines |
| 移至行首 | Home | cursorHome |
| 移至行尾 | End | cursorEnd |
| 移至檔案結尾 | ⌘↓ (Windows, Linux Ctrl+End) | cursorBottom |
| 移至檔案開頭 | ⌘↑ (Windows, Linux Ctrl+Home) | cursorTop |
| 將行向下捲動 | ⌃PageDown (Windows, Linux Ctrl+Down) | scrollLineDown |
| 將行向上捲動 | ⌃PageUp (Windows, Linux Ctrl+Up) | scrollLineUp |
| 將頁面向下捲動 | ⌘PageDown (Windows, Linux Alt+PageDown) | scrollPageDown |
| 將頁面向上捲動 | ⌘PageUp (Windows, Linux Alt+PageUp) | scrollPageUp |
| 摺疊 (收合) 區域 | ⌥⌘[ (Windows, Linux Ctrl+Shift+[) | editor.fold |
| 展開 (解除收合) 區域 | ⌥⌘] (Windows, Linux Ctrl+Shift+]) | editor.unfold |
| 切換區域摺疊狀態 | ⌘K ⌘L (Windows, Linux Ctrl+K Ctrl+L) | editor.toggleFold |
| 摺疊 (收合) 所有子區域 | ⌘K ⌘[ (Windows, Linux Ctrl+K Ctrl+[) | editor.foldRecursively |
| 展開 (解除收合) 所有子區域 | ⌘K ⌘] (Windows, Linux Ctrl+K Ctrl+]) | editor.unfoldRecursively |
| 摺疊 (收合) 所有區域 | ⌘K ⌘0 (Windows, Linux Ctrl+K Ctrl+0) | editor.foldAll |
| 展開 (解除收合) 所有區域 | ⌘K ⌘J (Windows, Linux Ctrl+K Ctrl+J) | editor.unfoldAll |
| 新增行註解 | ⌘K ⌘C (Windows, Linux Ctrl+K Ctrl+C) | editor.action.addCommentLine |
| 移除行註解 | ⌘K ⌘U (Windows, Linux Ctrl+K Ctrl+U) | editor.action.removeCommentLine |
| 切換行註解 | ⌘/ (Windows, Linux Ctrl+/) | editor.action.commentLine |
| 切換區塊註解 | ⇧⌥A (Windows Shift+Alt+A, Linux Ctrl+Shift+A) | editor.action.blockComment |
| 尋找 | ⌘F (Windows, Linux Ctrl+F) | actions.find |
| 取代 | ⌥⌘F (Windows, Linux Ctrl+H) | editor.action.startFindReplaceAction |
| 尋找下一個 | Enter | editor.action.nextMatchFindAction |
| 尋找上一個 | ⇧Enter (Windows, Linux Shift+Enter) | editor.action.previousMatchFindAction |
| 選取所有搜尋符合項 | ⌥Enter (Windows, Linux Alt+Enter) | editor.action.selectAllMatches |
| 切換大小寫是否相符 | ⌥⌘C (Windows, Linux Alt+C) | toggleFindCaseSensitive |
| 切換是否使用正規表示式 | ⌥⌘R (Windows, Linux Alt+R) | toggleFindRegex |
| 切換是否全字拼寫相符 | ⌥⌘W (Windows, Linux Alt+W) | toggleFindWholeWord |
| 切換 Tab 鍵是否用於切換焦點 | ⌃⇧M (Windows, Linux Ctrl+M) | editor.action.toggleTabFocusMode |
| 切換自動換行 | ⌥Z (Windows, Linux Alt+Z) | editor.action.toggleWordWrap |
豐富語言編輯
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 觸發建議 | ⌃Space (Windows, Linux Ctrl+Space) | editor.action.triggerSuggest |
| 觸發參數提示 | ⇧⌘Space (Windows, Linux Ctrl+Shift+Space) | editor.action.triggerParameterHints |
| 格式化文件 | ⇧⌥F (Windows Shift+Alt+F, Linux Ctrl+Shift+I) | editor.action.formatDocument |
| 格式化選取範圍 | ⌘K ⌘F (Windows, Linux Ctrl+K Ctrl+F) | editor.action.formatSelection |
| 移至定義 | F12 | editor.action.revealDefinition |
| 顯示懸浮說明 (Hover) | ⌘K ⌘I (Windows, Linux Ctrl+K Ctrl+I) | editor.action.showHover |
| 預覽定義 | ⌥F12 (Windows Alt+F12, Linux Ctrl+Shift+F10) | editor.action.peekDefinition |
| 在側邊開啟定義 | ⌘K F12 (Windows, Linux Ctrl+K F12) | editor.action.revealDefinitionAside |
| 快速修正 | ⌘. (Windows, Linux Ctrl+.) | editor.action.quickFix |
| 前往參考位置 | ⇧F12 (Windows, Linux Shift+F12) | editor.action.goToReferences |
| 重新命名符號 | F2 | editor.action.rename |
| 以「下一個值」取代 | ⇧⌘. (Windows, Linux Ctrl+Shift+.) | editor.action.inPlaceReplace.down |
| 以「上一個值」取代 | ⇧⌘, (Windows, Linux Ctrl+Shift+,) | editor.action.inPlaceReplace.up |
| 擴大 AST 選取範圍 | ⌃⇧⌘→ (Windows, Linux Shift+Alt+Right) | editor.action.smartSelect.expand |
| 縮小 AST 選取範圍 | ⌃⇧⌘← (Windows, Linux Shift+Alt+Left) | editor.action.smartSelect.shrink |
| 修剪行尾空白 | ⌘K ⌘X (Windows, Linux Ctrl+K Ctrl+X) | editor.action.trimTrailingWhitespace |
| 變更語言模式 | ⌘K M (Windows, Linux Ctrl+K M) | workbench.action.editor.changeLanguageMode |
瀏覽導覽
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 顯示所有符號 | ⌘T (Windows, Linux Ctrl+T) | workbench.action.showAllSymbols |
| 前往行號... | ⌃G (Windows, Linux Ctrl+G) | workbench.action.gotoLine |
| 前往檔案...,快速開啟 | ⌘P (Windows, Linux Ctrl+P) | workbench.action.quickOpen |
| 前往符號... | ⇧⌘O (Windows, Linux Ctrl+Shift+O) | workbench.action.gotoSymbol |
| 顯示問題 | ⇧⌘M (Windows, Linux Ctrl+Shift+M) | workbench.actions.view.problems |
| 前往下一個錯誤或警告 | F8 | editor.action.marker.nextInFiles |
| 前往上一個錯誤或警告 | ⇧F8 (Windows, Linux Shift+F8) | editor.action.marker.prevInFiles |
| 顯示所有命令 | ⇧⌘P (Windows, Linux Ctrl+Shift+P) 或 F1 | workbench.action.showCommands |
| 導覽編輯器群組歷程記錄 | ⌃Tab (Windows, Linux Ctrl+Tab) | workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup |
| 往回跳轉 | ⌃- (Windows Alt+Left, Linux Ctrl+Alt+-) | workbench.action.navigateBack |
| 在快速輸入中往回跳轉 | ⌃- (Windows Alt+Left, Linux Ctrl+Alt+-) | workbench.action.quickInputBack |
| 往前跳轉 | ⌃⇧- (Windows Alt+Right, Linux Ctrl+Shift+-) | workbench.action.navigateForward |
| 焦點移至麵包屑 (Breadcrumbs) | ⇧⌘; (Windows, Linux Ctrl+Shift+;) | breadcrumbs.focus |
| 焦點移至並選取麵包屑 | ⇧⌘. (Windows, Linux Ctrl+Shift+.) | breadcrumbs.focusAndSelect |
編輯器/視窗管理
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 新視窗 | ⇧⌘N (Windows, Linux Ctrl+Shift+N) | workbench.action.newWindow |
| 關閉視窗 | ⇧⌘W (Windows, Linux Alt+F4) | workbench.action.closeWindow |
| 關閉編輯器 | ⌘W (Windows Ctrl+F4, Linux Ctrl+W) | workbench.action.closeActiveEditor |
| 關閉資料夾 | ⌘K F (Windows, Linux Ctrl+K F) | workbench.action.closeFolder |
| 分割編輯器 | ⌘\ (Windows, Linux Ctrl+\) | workbench.action.splitEditor |
| 焦點移至第一個編輯器群組 | ⌘1 (Windows, Linux Ctrl+1) | workbench.action.focusFirstEditorGroup |
| 焦點移至第二個編輯器群組 | ⌘2 (Windows, Linux Ctrl+2) | workbench.action.focusSecondEditorGroup |
| 焦點移至第三個編輯器群組 | ⌘3 (Windows, Linux Ctrl+3) | workbench.action.focusThirdEditorGroup |
| 焦點移至左側編輯器群組 | ⌘K ⌘← (Windows, Linux Ctrl+K Ctrl+Left) | workbench.action.focusLeftGroup |
| 焦點移至右側編輯器群組 | ⌘K ⌘→ (Windows, Linux Ctrl+K Ctrl+Right) | workbench.action.focusRightGroup |
| 將編輯器向左移動 | ⌘K ⇧⌘← (Windows, Linux Ctrl+Shift+PageUp) | workbench.action.moveEditorLeftInGroup |
| 將編輯器向右移動 | ⌘K ⇧⌘→ (Windows, Linux Ctrl+Shift+PageDown) | workbench.action.moveEditorRightInGroup |
| 將作用中編輯器群組向左移動 | ⌘K ← (Windows, Linux Ctrl+K Left) | workbench.action.moveActiveEditorGroupLeft |
| 將作用中編輯器群組向右移動 | ⌘K → (Windows, Linux Ctrl+K Right) | workbench.action.moveActiveEditorGroupRight |
| 將編輯器移動至下一個群組 | ⌃⌘→ (Windows, Linux Ctrl+Alt+Right) | workbench.action.moveEditorToNextGroup |
| 將編輯器移動至上一個群組 | ⌃⌘← (Windows, Linux Ctrl+Alt+Left) | workbench.action.moveEditorToPreviousGroup |
檔案管理
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 新檔案 | ⌘N (Windows, Linux Ctrl+N) | workbench.action.files.newUntitledFile |
| 開啟檔案... | ⌘O (Windows, Linux Ctrl+O) | workbench.action.files.openFile |
| 儲存 | ⌘S (Windows, Linux Ctrl+S) | workbench.action.files.save |
| 全部儲存 | ⌥⌘S (Windows Ctrl+K S, Linux ) | saveAll |
| 另存新檔... | ⇧⌘S (Windows, Linux Ctrl+Shift+S) | workbench.action.files.saveAs |
| 關閉 | ⌘W (Windows Ctrl+F4, Linux Ctrl+W) | workbench.action.closeActiveEditor |
| 關閉群組 | ⌘K W (Windows, Linux Ctrl+K W) | workbench.action.closeEditorsInGroup |
| 全部關閉 | ⌘K ⌘W (Windows, Linux Ctrl+K Ctrl+W) | workbench.action.closeAllEditors |
| 重新開啟已關閉的編輯器 | ⇧⌘T (Windows, Linux Ctrl+Shift+T) | workbench.action.reopenClosedEditor |
| 保持開啟 | ⌘K Enter (Windows, Linux Ctrl+K Enter) | workbench.action.keepEditor |
| 複製作用中檔案的路徑 | ⌘K P (Windows, Linux Ctrl+K P) | workbench.action.files.copyPathOfActiveFile |
| 在檔案總管中顯示作用中檔案 | ⌘K R (Windows, Linux Ctrl+K R) | workbench.action.files.revealActiveFileInWindows |
顯示
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 切換全螢幕 | ⌃⌘F (Windows, Linux F11) | workbench.action.toggleFullScreen |
| 切換禪模式 (Zen Mode) | ⌘K Z (Windows, Linux Ctrl+K Z) | workbench.action.toggleZenMode |
| 離開禪模式 | Escape Escape | workbench.action.exitZenMode |
| 放大 | ⌘= (Windows, Linux Ctrl+=) | workbench.action.zoomIn |
| 縮小 | ⌘- (Windows, Linux Ctrl+-) | workbench.action.zoomOut |
| 重設縮放 | ⌘Numpad0 (Windows, Linux Ctrl+Numpad0) | workbench.action.zoomReset |
| 切換側邊欄可見度 | ⌘B (Windows, Linux Ctrl+B) | workbench.action.toggleSidebarVisibility |
| 顯示檔案總管 / 切換焦點 | ⇧⌘E (Windows, Linux Ctrl+Shift+E) | workbench.view.explorer |
| 顯示搜尋 | ⇧⌘F (Windows, Linux Ctrl+Shift+F) | workbench.view.search |
| 顯示原始碼控制 | ⌃⇧G (Windows, Linux Ctrl+Shift+G) | workbench.view.scm |
| 顯示執行與偵錯 | ⇧⌘D (Windows, Linux Ctrl+Shift+D) | workbench.view.debug |
| 顯示延伸模組 | ⇧⌘X (Windows, Linux Ctrl+Shift+X) | workbench.view.extensions |
| 顯示輸出 | ⇧⌘U (Windows Ctrl+Shift+U, Linux Ctrl+K Ctrl+H) | workbench.action.output.toggleOutput |
| 快速開啟檢視 | ⌃Q (Windows Ctrl+Q, Linux ) | workbench.action.quickOpenView |
| 開啟新命令提示字元 | ⇧⌘C (Windows, Linux Ctrl+Shift+C) | workbench.action.terminal.openNativeConsole |
| 切換 Markdown 預覽 | markdown.showPreview |
|
| 在側邊開啟預覽 | markdown.showPreviewToSide |
|
| 切換整合式終端機 | ⌃` (Windows, Linux Ctrl+`) | workbench.action.terminal.toggleTerminal |
搜尋 (Search)
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 顯示搜尋 | ⇧⌘F (Windows, Linux Ctrl+Shift+F) | workbench.view.search |
| 在檔案中取代 | ⇧⌘H (Windows, Linux Ctrl+Shift+H) | workbench.action.replaceInFiles |
| 切換大小寫是否相符 | ⌥⌘C (Windows, Linux Alt+C) | toggleSearchCaseSensitive |
| 切換是否全字拼寫相符 | ⌥⌘W (Windows, Linux Alt+W) | toggleSearchWholeWord |
| 切換是否使用正規表示式 | ⌥⌘R (Windows, Linux Alt+R) | toggleSearchRegex |
| 切換搜尋詳細資料 | ⇧⌘J (Windows, Linux Ctrl+Shift+J) | workbench.action.search.toggleQueryDetails |
| 焦點移至下一個搜尋結果 | F4 | search.action.focusNextSearchResult |
| 焦點移至上一個搜尋結果 | ⇧F4 (Windows, Linux Shift+F4) | search.action.focusPreviousSearchResult |
| 顯示下一個搜尋字詞 | ↓ (Windows, Linux Down) | history.showNext |
| 顯示上一個搜尋字詞 | ↑ (Windows, Linux Up) | history.showPrevious |
搜尋編輯器
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 在編輯器中開啟結果 | ⌘Enter (Windows, Linux Alt+Enter) | search.action.openInEditor |
| 焦點移至搜尋編輯器輸入框 | Escape | search.action.focusQueryEditorWidget |
| 再次搜尋 | ⇧⌘R (Windows, Linux Ctrl+Shift+R) | rerunSearchEditorSearch |
| 刪除檔案搜尋結果 | ⇧⌘Backspace (Windows, Linux Ctrl+Shift+Backspace) | search.searchEditor.action.deleteFileResults |
偏好設定
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 開啟設定 | ⌘, (Windows, Linux Ctrl+,) | workbench.action.openSettings |
| 開啟鍵盤快速鍵 | ⌘K ⌘S (Windows, Linux Ctrl+K Ctrl+S) | workbench.action.openGlobalKeybindings |
| 選取色彩佈景主題 | ⌘K ⌘T (Windows, Linux Ctrl+K Ctrl+T) | workbench.action.selectTheme |
聊天
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 開啟聊天視圖 | ⌃⌘I (Windows、Linux Ctrl+Alt+I) | workbench.action.chat.open |
| 以代理模式開啟聊天 | ⇧⌘I (Windows Ctrl+Shift+I, Linux Ctrl+Shift+Alt+I) | workbench.action.chat.openagent |
| 開啟編輯器內嵌聊天 | ⌘I (Windows、Linux Ctrl+I) | inlineChat.start |
| 開啟終端機內嵌聊天 | ⌘I (Windows、Linux Ctrl+I) | workbench.action.terminal.chat.start |
| 開啟快速聊天 | ⇧⌥⌘L (Windows、Linux Ctrl+Shift+Alt+L) | workbench.action.quickchat.toggle |
| 開啟代理挑選器 | ⌘. (Windows, Linux Ctrl+.) | workbench.action.chat.openModePicker |
| 開啟語言模型挑選器 | ⌥⌘. (Windows, Linux Ctrl+Alt+.) | workbench.action.chat.openModelPicker |
| 新聊天工作階段 | ⌘N (Windows, Linux Ctrl+N) | workbench.action.chat.newChat |
| 接受內嵌建議 | Tab | editor.action.inlineSuggest.commit |
偵錯
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 切換中斷點 | F9 | editor.debug.action.toggleBreakpoint |
| 開始偵錯 | F5 | workbench.action.debug.start |
| 繼續 | F5 | workbench.action.debug.continue |
| 開始執行 (不偵錯) | ⌃F5 (Windows, Linux Ctrl+F5) | workbench.action.debug.run |
| 暫停 | F6 | workbench.action.debug.pause |
| 逐步執行 (Step Into) | F11 | workbench.action.debug.stepInto |
工作 (Tasks)
| 指令 | 按鍵 | 指令 ID |
|---|---|---|
| 執行建置工作 | ⇧⌘B (Windows, Linux Ctrl+Shift+B) | workbench.action.tasks.build |