欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

VS Code vscode 的常用快捷键 自定义快捷键文件 keybindings.json 有大用 有大大用 有大大大用 有大大大大用

下面红色部分 有大用


官网 快捷键

https://code.visualstudio.com/docs/getstarted/keybindings


Key Bindings for Visual Studio Code

Visual Studio Code lets you perform most tasks directly from the keyboard. This page lists out the default bindings (keyboard shortcuts) and describes how you can update them.

Note: If you visit this page on a Mac, you will see the key bindings for the Mac. If you visit using Windows or Linux, you will see the keys for that platform. If you need the key bindings for another platform, hover your mouse over the key you are interested in.

Keyboard Shortcuts editor

Visual Studio Code provides a rich and easy keyboard shortcuts editing experience using Keyboard Shortcuts editor. It lists all available commands with and without keybindings and you can easily change / remove / reset their keybindings using the available actions. It also has a search box on the top that helps you in finding commands or keybindings. You can open this editor by going to the menu under File > Preferences > Keyboard Shortcuts. (Code > Preferences > Keyboard Shortcuts on macOS)

Keyboard Shortcuts

Most importantly, you can see keybindings according to your keyboard layout. For example, key binding Cmd+\ in US keyboard layout will be shown as Ctrl+Shift+Alt+Cmd+7 when layout is changed to German. The dialog to enter key binding will assign the correct and desired key binding as per your keyboard layout.

For doing more advanced keyboard shortcut customization, read Advanced Customization.

Keymap extensions

Keyboard shortcuts are vital to productivity and changing keyboarding habits can be tough. To help with this, File > Preferences > Keymap Extensions shows you a list of popular keymap extensions. These extensions modify the VS Code shortcuts to match those of other editors so you don't need to learn new keyboard shortcuts. There is also a Keymaps category of extensions in the Marketplace.

Tip: Click on an extension tile above to read the description and reviews to decide which extension is best for you. See more in the Marketplace.

Keyboard Shortcuts Reference

We also have a printable version of these keyboard shortcuts. Help > Keyboard Shortcut Reference displays a condensed PDF version suitable for printing as an easy reference.

Below are links to the three platform-specific versions:

Detecting keybinding conflicts

If you have many extensions installed or you have customized your keyboard shortcuts, you can sometimes have keybinding conflicts where the same keyboard shortcut is mapped to several commands. This can result in confusing behavior, especially if different keybindings are going in and out of scope as you move around the editor.

The Keyboard Shortcuts editor has a context menu command Show Same Keybindings, which will filter the keybindings based on a keyboard shortcut to display conflicts.

show keybinding conflicts menu

Pick a command with the keybinding you think is overloaded and you can see if multiple commands are defined, the source of the keybindings and when they are active.

show keybinding conflicts result

Viewing modified keybindings

You can view any user modified keyboard shortcuts in VS Code in the Keyboard Shortcuts editor with the Show User Keybindings command in the More Actions (...) menu. This applies the @source:user filter to the Keyboard Shortcuts editor (Source is 'User').

Default Keyboard Shortcuts


高级定制

VS Code 中的所有键盘快捷键都可以通过该 keybindings.json 文件进行自定义。

  • 要通过 JSON 文件配置键盘快捷键,请打开 键盘快捷键 编辑器并选择  编辑器标题栏右侧的打开键盘快捷键 (JSON)按钮。

  • 这将打开您的 keybindings.json 文件,您可以在其中覆盖 Default Keybindings

Advanced customization

All keyboard shortcuts in VS Code can be customized via the keybindings.json file.

  • To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar.

  • This will open your keybindings.json file where you can overwrite the Default Keybindings.

Open Keyboard Shortcuts JSON button

You can also open the keybindings.json file from the Command Palette (Ctrl+Shift+P) with the Preferences: Open Keyboard Shortcuts (JSON) command.

Keyboard rules

The keyboard shortcuts dispatching is done by analyzing a list of rules that are expressed in JSON. Here are some examples:

// Keybindings that are active when the focus is in the editor
{ "key": "home",            "command": "cursorHome",                  "when": "editorTextFocus" },
{ "key": "shift+home",      "command": "cursorHomeSelect",            "when": "editorTextFocus" },

// Keybindings that are complementary
{ "key": "f5",              "command": "workbench.action.debug.continue", "when": "inDebugMode" },
{ "key": "f5",              "command": "workbench.action.debug.start",    "when": "!inDebugMode" },

// Global keybindings
{ "key": "ctrl+f",          "command": "actions.find" },
{ "key": "alt+left",        "command": "workbench.action.navigateBack" },
{ "key": "alt+right",       "command": "workbench.action.navigateForward" },

// Global keybindings using chords (two separate keypress actions)
{ "key": "ctrl+k enter",    "command": "workbench.action.keepEditor" },
{ "key": "ctrl+k ctrl+w",   "command": "workbench.action.closeAllEditors" },

Each rule consists of:

  • key that describes the pressed keys.

  • command containing the identifier of the command to execute.

  • an optional when clause containing a boolean expression that will be evaluated depending on the current context.

Chords (two separate keypress actions) are described by separating the two keypresses with a space. For example, Ctrl+K Ctrl+C.

When a key is pressed:

  • the rules are evaluated from bottom to top.

  • the first rule that matches, both the key and in terms of when, is accepted.

  • no more rules are processed.

  • if a rule is found and has a command set, the command is executed.

The additional keybindings.json rules are appended at runtime to the bottom of the default rules, thus allowing them to overwrite the default rules. The keybindings.json file is watched by VS Code so editing it while VS Code is running will update the rules at runtime.

Accepted keys

The key is made up of modifiers and the key itself.

The following modifiers are accepted:

PlatformModifiers
macOSCtrl+Shift+Alt+Cmd+
WindowsCtrl+Shift+Alt+Win+
LinuxCtrl+Shift+Alt+Meta+

The following keys are accepted:

  • f1-f19a-z0-9

  • `-=[]\;',./

  • leftuprightdownpageuppagedownendhome

  • tabenterescapespacebackspacedelete

  • pausebreakcapslockinsert

  • numpad0-numpad9numpad_multiplynumpad_addnumpad_separator

  • numpad_subtractnumpad_decimalnumpad_divide

Command arguments

You can invoke a command with arguments. This is useful if you often perform the same operation on a specific file or folder. You can add a custom keyboard shortcut to do exactly what you want.

The following is an example overriding the Enter key to print some text:

{
  "key": "enter",
  "command": "type",
  "args": { "text": "Hello World" },
  "when": "editorTextFocus"
}

The type command will receive {"text": "Hello World"} as its first argument and add "Hello World" to the file instead of producing the default command.

For more information on commands that take arguments, refer to Built-in Commands.

Removing a specific key binding rule

You can write a key binding rule that targets the removal of a specific default key binding. With the keybindings.json, it was always possible to redefine all the key bindings of VS Code, but it can be difficult to make a small tweak, especially around overloaded keys, such as Tab or Escape. To remove a specific key binding, add a - to the command and the rule will be a removal rule.

Here is an example:

// In Default Keyboard Shortcuts
...
{ "key": "tab", "command": "tab", "when": ... },
{ "key": "tab", "command": "jumpToNextSnippetPlaceholder", "when": ... },
{ "key": "tab", "command": "acceptSelectedSuggestion", "when": ... },
...

// To remove the second rule, for example, add in keybindings.json:
{ "key": "tab", "command": "-jumpToNextSnippetPlaceholder" }

Keyboard layouts

Note: This section relates only to key bindings, not to typing in the editor.

The keys above are string representations for virtual keys and do not necessarily relate to the produced character when they are pressed. More precisely:

  • Reference: Virtual-Key Codes (Windows)

  • tab for VK_TAB (0x09)

  • ; for VK_OEM_1 (0xBA)

  • = for VK_OEM_PLUS (0xBB)

  • , for VK_OEM_COMMA (0xBC)

  • - for VK_OEM_MINUS (0xBD)

  • . for VK_OEM_PERIOD (0xBE)

  • / for VK_OEM_2 (0xBF)

  • ` for VK_OEM_3 (0xC0)

  • [ for VK_OEM_4 (0xDB)

  • \ for VK_OEM_5 (0xDC)

  • ] for VK_OEM_6 (0xDD)

  • ' for VK_OEM_7 (0xDE)

  • etc.

Different keyboard layouts usually reposition the above virtual keys or change the characters produced when they are pressed. When using a different keyboard layout than the standard US, Visual Studio Code does the following:

All the key bindings are rendered in the UI using the current system's keyboard layout. For example, Split Editor when using a French (France) keyboard layout is now rendered as Ctrl+*:

render key binding

When editing keybindings.json, VS Code highlights misleading key bindings, those that are represented in the file with the character produced under the standard US keyboard layout, but that need pressing keys with different labels under the current system's keyboard layout. For example, here is how the Default Keyboard Shortcuts rules look like when using a French (France) keyboard layout:

keybindings.json guidance

There is also a widget that helps input the key binding rule when editing keybindings.json. To launch the Define Keybinding widget, press Ctrl+K Ctrl+K. The widget listens for key presses and renders the serialized JSON representation in the text box and below it, the keys that VS Code has detected under your current keyboard layout. Once you've typed the key combination you want, you can press Enter and a rule snippet will be inserted.

key binding widget

Note: On Linux, Visual Studio Code detects your current keyboard layout on start-up and then caches this information. For a good experience, we recommend restarting VS Code if you change your keyboard layout.


Keyboard layout-independent bindings

Using scan codes, it is possible to define keybindings which do not change with the change of the keyboard layout. For example:

{
  "key": "cmd+[Slash]",
  "command": "editor.action.commentLine",
  "when": "editorTextFocus"
}

Accepted scan codes:

  • [F1]-[F19][KeyA]-[KeyZ][Digit0]-[Digit9]

  • [Backquote][Minus][Equal][BracketLeft][BracketRight][Backslash][Semicolon][Quote][Comma][Period][Slash]

  • [ArrowLeft][ArrowUp][ArrowRight][ArrowDown][PageUp][PageDown][End][Home]

  • [Tab][Enter][Escape][Space][Backspace][Delete]

  • [Pause][CapsLock][Insert]

  • [Numpad0]-[Numpad9][NumpadMultiply][NumpadAdd][NumpadComma]

  • [NumpadSubtract][NumpadDecimal][NumpadDivide]

'when' clause contexts

VS Code gives you fine control over when your key bindings are enabled through the optional when clause. If your key binding doesn't have a when clause, the key binding is globally available at all times.

Below are some of the possible when clause contexts which evaluate to Boolean true/false. For conditional expressions, you can use either equality == ("editorLangId == typescript") or inequality != ("resourceExtname != .js").

Context nameTrue when
Editor contexts
editorFocusAn editor has focus, either the text or a widget.
editorTextFocusThe text in an editor has focus (cursor is blinking).
textInputFocusAny editor has focus (regular editor, debug REPL, etc.).
inputFocusAny text input area has focus (editors or text boxes).
editorHasSelectionText is selected in the editor.
editorHasMultipleSelectionsMultiple regions of text are selected (multiple cursors).
editorReadonlyThe editor is read only.
editorLangIdTrue when the editor's associated language Id matches. Example: "editorLangId == typescript".
isInDiffEditorThe active editor is a difference editor.
isInEmbeddedEditorTrue when the focus is inside an embedded editor.
Operating system contexts
isLinuxTrue when the OS is Linux
isMacTrue when the OS is macOS
isWindowsTrue when the OS is Windows
isWebTrue when accessing the editor from the Web
List contexts
listFocusA list has focus.
listSupportsMultiselectA list supports multi select.
listHasSelectionOrFocusA list has selection or focus.
listDoubleSelectionA list has a selection of 2 elements.
listMultiSelectionA list has a selection of multiple elements.
Mode contexts
inDebugModeA debug session is running.
debugTypeTrue when debug type matches. Example: "debugType == 'node'".
inSnippetModeThe editor is in snippet mode.
inQuickOpenThe Quick Open drop-down has focus.
Resource contexts
resourceSchemeTrue when the resource Uri scheme matches. Example: "resourceScheme == file"
resourceFilenameTrue when the Explorer or editor filename matches. Example: "resourceFilename == gulpfile.js"
resourceExtnameTrue when the Explorer or editor filename extension matches. Example: "resourceExtname == .js"
resourceLangIdTrue when the Explorer or editor title language Id matches. Example: "resourceLangId == markdown"
isFileSystemResourceisFileSystemResourceTrue when the Explorer or editor file is a file system resource that can be handled from a file system provider
resourceSetTrue when an Explorer or editor file is set
resourceThe full Uri of the Explorer or editor file
Explorer contexts
explorerViewletVisibleTrue if Explorer view is visible.
explorerViewletFocusTrue if Explorer view has keyboard focus.
filesExplorerFocusTrue if File Explorer section has keyboard focus.
openEditorsFocusTrue if OPEN EDITORS section has keyboard focus.
explorerResourceIsFolderTrue if a folder is selected in the Explorer.
Editor widget contexts
findWidgetVisibleEditor Find widget is visible.
suggestWidgetVisibleSuggestion widget (IntelliSense) is visible.
suggestWidgetMultipleSuggestionsMultiple suggestions are displayed.
renameInputVisibleRename input text box is visible.
referenceSearchVisiblePeek References peek window is open.
inReferenceSearchEditorThe Peek References peek window editor has focus.
config.editor.stablePeekKeep peek editors open (controlled by editor.stablePeek setting).
quickFixWidgetVisibleQuick Fix widget is visible.
parameterHintsVisibleParameter hints are visible (controlled by editor.parameterHints.enabled setting).
parameterHintsMultipleSignaturesMultiple parameter hints are displayed.
Integrated terminal contexts
terminalFocusAn integrated terminal has focus.
terminalIsOpenAn integrated terminal is opened.
Global UI contexts
notificationFocusNotification has keyboard focus.
notificationCenterVisibleNotification Center is visible at the bottom right of VS Code.
notificationToastsVisibleNotification toast is visible at the bottom right of VS Code.
searchViewletVisibleSearch view is open.
sideBarVisibleSide Bar is displayed.
sideBarFocusSide Bar has focus.
panelFocusPanel has focus.
inZenModeWindow is in Zen Mode.
isCenteredLayoutEditor is in centered layout mode.
inDebugReplFocus is in the Debug Console REPL.
workspaceFolderCountCount of workspace folders.
replaceActiveSearch view Replace text box is open.
viewTrue when view identifier matches. Example: "view == myViewsExplorerID".
viewItemTrue when viewItem context matches. Example: "viewItem == someContextValue".
isFullscreenTrue when window is in fullscreen.
focusedViewThe identifier of the currently focused view.
canNavigateBackTrue if it is possible to navigate back.
canNavigateForwardTrue if it is possible to navigate forward.
canNavigateToLastEditLocationTrue if it is possible to navigate to the last edit location.
Global Editor UI contexts
textCompareEditorVisibleAt least one diff (compare) editor is visible.
textCompareEditorActiveA diff (compare) editor is active.
editorIsOpenTrue if one editor is open.
groupActiveEditorDirtyTrue when the active editor in a group is dirty.
groupEditorsCountNumber of editors in a group.
activeEditorGroupEmptyTrue if the active editor group has no editors.
activeEditorGroupIndexIndex of the active editor in an group (beginning with 1).
activeEditorGroupLastTrue when the active editor in an group is the last one.
multipleEditorGroupsTrue when multiple editor groups are present.
editorPinnedTrue when the active editor in a group is pinned (not in preview mode).
activeEditorThe identifier of the active editor in a group.
Configuration settings contexts
config.editor.minimap.enabledTrue when the setting editor.minimap.enabled is true.

Note: You can use any user or workspace setting that evaluates to a boolean here with the prefix "config.".

The list above isn't exhaustive and you may see some when contexts for specific VS Code UI in the Default Keyboard Shortcuts.

Active/Focused view or panel 'when' clause context

You can have a keybinding that is enabled only when a specific view or panel is visible.

Context nameTrue when
activeViewletTrue when view is visible. Example: "activeViewlet == 'workbench.view.explorer'"
activePanelTrue when panel is visible. Example: "activePanel == 'workbench.panel.output'"
focusedViewTrue when view is focused. Example: "focusedView == myViewsExplorerID

View Identifiers:

  • workbench.view.explorer - File Explorer

  • workbench.view.search - Search

  • workbench.view.scm - Source Control

  • workbench.view.debug - Debug

  • workbench.view.extensions - Extensions

Panel Identifiers:

  • workbench.panel.markers - Problems

  • workbench.panel.output - Output

  • workbench.panel.repl - Debug Console

  • workbench.panel.terminal - Integrated Terminal

  • workbench.panel.comments - Comments

  • workbench.view.search - Search when search.location is set to panel

If you want a keybinding that is enabled only when a specific view or panel has focus, use sideBarFocus or panelFocus in combination with activeViewlet or activiewFocus.

For example, the when clause below is true only when the File Explorer has focus:

"sideBarFocus && activeViewlet == 'workbench.view.explorer'"

key-value when clause operator



接着    /node-admin/21320



接上面  /node-admin/21331

key-value when clause operator

There is a key-value pair operator for when clauses. The expression key =~ value treats the right hand side as a regular expression to match against the left hand side. For example, to contribute context menu items for all Docker files, one could use:

   "when": "resourceFilename =~ /docker/"


Custom keybindings for refactorings

The editor.action.codeAction command lets you configure keybindings for specific Refactorings (Code Actions). For example, the keybinding below triggers the Extract function refactoring Code Actions:

{
  "key": "ctrl+shift+r ctrl+e",
  "command": "editor.action.codeAction",
  "args": {
    "kind": "refactor.extract.function"
  }
}


This is covered in depth in the Refactoring topic where you can learn about different kinds of Code Actions and how to prioritize them in the case of multiple possible refactorings.

Default Keyboard Shortcuts

You can view all default keyboard shortcuts in VS Code in the Keyboard Shortcuts editor with the Show Default Keybindings command in the More Actions (...) menu. This applies the @source:default filter to the Keyboard Shortcuts editor (Source is 'Default').

Default Keyboard Shortcuts

You can view the default keyboard shortcuts as a JSON file using the command Preferences: Open Default Keyboard Shortcuts (JSON).

Note: The following keys are rendered assuming a standard US keyboard layout. If you use a different keyboard layout, please read below. You can view the currently active keyboard shortcuts in VS Code in the Command Palette (View -> Command Palette) or in the Keyboard Shortcuts editor (File > Preferences > Keyboard Shortcuts).

Some commands included below do not have default keyboard shortcuts and so are displayed as unassigned but you can assign your own keybindings.

Basic Editing

KeyCommandCommand id
Ctrl+X            Cut line (empty selection)editor.action.clipboardCutAction            
Ctrl+C            Copy line (empty selection)editor.action.clipboardCopyAction            
Ctrl+Shift+K            Delete Lineeditor.action.deleteLines            
Ctrl+Enter            Insert Line Beloweditor.action.insertLineAfter            
Ctrl+Shift+Enter            Insert Line Aboveeditor.action.insertLineBefore            
Alt+Down            Move Line Downeditor.action.moveLinesDownAction            
Alt+Up            Move Line Upeditor.action.moveLinesUpAction            
Shift+Alt+Down            Copy Line Downeditor.action.copyLinesDownAction            
Shift+Alt+Up            Copy Line Upeditor.action.copyLinesUpAction            
Ctrl+D            Add Selection To Next Find Match

editor.action.addSelectionToNextFindMatch                 

 查找发现搜索下一个相同的选择 select                   

Ctrl+K Ctrl+D            Move Last Selection To Next Find Match

editor.action.moveSelectionToNextFindMatch                  


               

Ctrl+U            Undo last cursor operationcursorUndo            
Shift+Alt+I            Insert cursor at end of each line selectededitor.action.insertCursorAtEndOfEachLineSelected            
Ctrl+Shift+L            Select all occurrences of current selectioneditor.action.selectHighlights            
Ctrl+F2            Select all occurrences of current wordeditor.action.changeAll            
Ctrl+L            Select current lineexpandLineSelection            
Ctrl+Alt+Down            Insert Cursor Beloweditor.action.insertCursorBelow            
Ctrl+Alt+Up            Insert Cursor Aboveeditor.action.insertCursorAbove            
Ctrl+Shift+\            Jump to matching bracketeditor.action.jumpToBracket            
Ctrl+]            Indent Lineeditor.action.indentLines            
Ctrl+[            Outdent Lineeditor.action.outdentLines            
Home            Go to Beginning of LinecursorHome            
End            Go to End of LinecursorEnd            
Ctrl+End            Go to End of FilecursorBottom            
Ctrl+Home            Go to Beginning of FilecursorTop            
Ctrl+Down            Scroll Line DownscrollLineDown            
Ctrl+Up            Scroll Line UpscrollLineUp            
Alt+PageDown            Scroll Page DownscrollPageDown            
Alt+PageUp            Scroll Page UpscrollPageUp            
Ctrl+Shift+[            Fold (collapse) regioneditor.fold            
Ctrl+Shift+]            Unfold (uncollapse) regioneditor.unfold            
Ctrl+K Ctrl+[            Fold (collapse) all subregionseditor.foldRecursively            
Ctrl+K Ctrl+]            Unfold (uncollapse) all subregionseditor.unfoldRecursively            
Ctrl+K Ctrl+0            Fold (collapse) all regionseditor.foldAll            
Ctrl+K Ctrl+J            Unfold (uncollapse) all regionseditor.unfoldAll            
Ctrl+K Ctrl+C            Add Line Commenteditor.action.addCommentLine            
Ctrl+K Ctrl+U            Remove Line Commenteditor.action.removeCommentLine            
Ctrl+/            Toggle Line Commenteditor.action.commentLine            
Shift+Alt+A            Toggle Block Commenteditor.action.blockComment            
Ctrl+F            Findactions.find            
Ctrl+H            Replaceeditor.action.startFindReplaceAction            
Enter            Find Nexteditor.action.nextMatchFindAction            
Shift+Enter            Find Previouseditor.action.previousMatchFindAction            
Alt+Enter            Select All Occurrences of Find Matcheditor.action.selectAllMatches            
Alt+C            Toggle Find Case SensitivetoggleFindCaseSensitive            
Alt+R            Toggle Find RegextoggleFindRegex            
Alt+W            Toggle Find Whole WordtoggleFindWholeWord            
Ctrl+M            Toggle Use of Tab Key for Setting Focuseditor.action.toggleTabFocusMode            
unassigned            Toggle Render WhitespacetoggleRenderWhitespace            
Alt+Z            Toggle Word Wrapeditor.action.toggleWordWrap            

Rich Languages Editing

KeyCommandCommand id
Ctrl+Space            Trigger Suggesteditor.action.triggerSuggest            
Ctrl+Shift+Space            Trigger Parameter Hintseditor.action.triggerParameterHints            
Shift+Alt+F            Format Documenteditor.action.formatDocument            
Ctrl+K Ctrl+F            Format Selectioneditor.action.formatSelection            
F12            Go to Definitioneditor.action.revealDefinition            
Ctrl+K Ctrl+I            Show Hovereditor.action.showHover            
Alt+F12            Peek Definitioneditor.action.peekDefinition            
Ctrl+K F12            Open Definition to the Sideeditor.action.revealDefinitionAside            
Ctrl+.            Quick Fixeditor.action.quickFix            
Shift+F12            Peek Referenceseditor.action.referenceSearch.trigger            
F2            Rename Symboleditor.action.rename            
Ctrl+Shift+.            Replace with Next Valueeditor.action.inPlaceReplace.down            
Ctrl+Shift+,            Replace with Previous Valueeditor.action.inPlaceReplace.up            
Shift+Alt+Right            Expand AST Selectioneditor.action.smartSelect.expand            
Shift+Alt+Left            Shrink AST Selectioneditor.action.smartSelect.shrink            
Ctrl+K Ctrl+X            Trim Trailing Whitespaceeditor.action.trimTrailingWhitespace            
Ctrl+K M            Change Language Modeworkbench.action.editor.changeLanguageMode            

Navigation

KeyCommandCommand id
Ctrl+T            Show All Symbolsworkbench.action.showAllSymbols            
Ctrl+G            Go to Line...workbench.action.gotoLine            
Ctrl+P            Go to File..., Quick Openworkbench.action.quickOpen            
Ctrl+Shift+O            Go to Symbol...workbench.action.gotoSymbol            
Ctrl+Shift+M            Show Problemsworkbench.actions.view.problems            
F8            Go to Next Error or Warningeditor.action.marker.nextInFiles            
Shift+F8            Go to Previous Error or Warningeditor.action.marker.prevInFiles            
Ctrl+Shift+P or F1            Show All Commandsworkbench.action.showCommands            
Ctrl+Shift+Tab            Navigate Editor Group Historyworkbench.action.openPreviousRecentlyUsedEditorInGroup            
Alt+Left            Go Backworkbench.action.navigateBack            
Alt+Left            Go back in Quick Inputworkbench.action.quickInputBack            
Alt+Right            Go Forwardworkbench.action.navigateForward            

Editor/Window Management

KeyCommandCommand id
Ctrl+Shift+N            New Windowworkbench.action.newWindow            
Ctrl+W            Close Windowworkbench.action.closeWindow            
Ctrl+F4            Close Editorworkbench.action.closeActiveEditor            
Ctrl+K F            Close Folderworkbench.action.closeFolder            
unassigned            Cycle Between Editor Groupsworkbench.action.navigateEditorGroups            
Ctrl+\            Split Editorworkbench.action.splitEditor            
Ctrl+1            Focus into First Editor Groupworkbench.action.focusFirstEditorGroup            
Ctrl+2            Focus into Second Editor Groupworkbench.action.focusSecondEditorGroup            
Ctrl+3            Focus into Third Editor Groupworkbench.action.focusThirdEditorGroup            
unassigned            Focus into Editor Group on the Leftworkbench.action.focusPreviousGroup            
unassigned            Focus into Editor Group on the Rightworkbench.action.focusNextGroup            
Ctrl+Shift+PageUp            Move Editor Leftworkbench.action.moveEditorLeftInGroup            
Ctrl+Shift+PageDown            Move Editor Rightworkbench.action.moveEditorRightInGroup            
Ctrl+K Left            Move Active Editor Group Leftworkbench.action.moveActiveEditorGroupLeft            
Ctrl+K Right            Move Active Editor Group Rightworkbench.action.moveActiveEditorGroupRight            
Ctrl+Alt+Right            Move Editor into Next Groupworkbench.action.moveEditorToNextGroup            
Ctrl+Alt+Left            Move Editor into Previous Groupworkbench.action.moveEditorToPreviousGroup            

File Management

KeyCommandCommand id
Ctrl+N            New Fileworkbench.action.files.newUntitledFile            
Ctrl+O            Open File...workbench.action.files.openFile            
Ctrl+S            Saveworkbench.action.files.save            
Ctrl+K S            Save Allworkbench.action.files.saveAll            
Ctrl+Shift+S            Save As...workbench.action.files.saveAs            
Ctrl+F4            Closeworkbench.action.closeActiveEditor            
unassigned            Close Othersworkbench.action.closeOtherEditors            
Ctrl+K W            Close Groupworkbench.action.closeEditorsInGroup            
unassigned            Close Other Groupsworkbench.action.closeEditorsInOtherGroups            
unassigned            Close Group to Leftworkbench.action.closeEditorsToTheLeft            
unassigned            Close Group to Rightworkbench.action.closeEditorsToTheRight            
Ctrl+K Ctrl+W            Close Allworkbench.action.closeAllEditors            
Ctrl+Shift+T            Reopen Closed Editorworkbench.action.reopenClosedEditor            
Ctrl+K Enter            Keep Openworkbench.action.keepEditor            
Ctrl+Tab            Open Nextworkbench.action.openNextRecentlyUsedEditorInGroup            
Ctrl+Shift+Tab            Open Previousworkbench.action.openPreviousRecentlyUsedEditorInGroup            
Ctrl+K P            Copy Path of Active Fileworkbench.action.files.copyPathOfActiveFile            
Ctrl+K R            Reveal Active File in Windowsworkbench.action.files.revealActiveFileInWindows            
Ctrl+K O            Show Opened File in New Windowworkbench.action.files.showOpenedFileInNewWindow            
unassigned            Compare Opened File Withworkbench.files.action.compareFileWith            

Display

KeyCommandCommand id
F11            Toggle Full Screenworkbench.action.toggleFullScreen            
Ctrl+K Z            Toggle Zen Modeworkbench.action.toggleZenMode            
Escape Escape            Leave Zen Modeworkbench.action.exitZenMode            
Ctrl+=            Zoom inworkbench.action.zoomIn            
Ctrl+-            Zoom outworkbench.action.zoomOut            
Ctrl+Numpad0            Reset Zoomworkbench.action.zoomReset            
Ctrl+B            Toggle Sidebar Visibilityworkbench.action.toggleSidebarVisibility            
Ctrl+Shift+E            Show Explorer / Toggle Focusworkbench.view.explorer            
Ctrl+Shift+F            Show Searchworkbench.view.search            
Ctrl+Shift+G            Show Source Controlworkbench.view.scm            
Ctrl+Shift+D            Show Debugworkbench.view.debug            
Ctrl+Shift+X            Show Extensionsworkbench.view.extensions            
Ctrl+Shift+U            Show Outputworkbench.action.output.toggleOutput            
Ctrl+Q            Quick Open Viewworkbench.action.quickOpenView            
Ctrl+Shift+C            Open New Command Promptworkbench.action.terminal.openNativeConsole            
Ctrl+Shift+V            Toggle Markdown Previewmarkdown.showPreview            
Ctrl+K V            Open Preview to the Sidemarkdown.showPreviewToSide            
Ctrl+`            Toggle Integrated Terminalworkbench.action.terminal.toggleTerminal            

Search

KeyCommandCommand id
Ctrl+Shift+F            Show Searchworkbench.view.search            
Ctrl+Shift+H            Replace in Filesworkbench.action.replaceInFiles            
Alt+C            Toggle Match CasetoggleSearchCaseSensitive            
Alt+W            Toggle Match Whole WordtoggleSearchWholeWord            
Alt+R            Toggle Use Regular ExpressiontoggleSearchRegex            
Ctrl+Shift+J            Toggle Search Detailsworkbench.action.search.toggleQueryDetails            
F4            Focus Next Search Resultsearch.action.focusNextSearchResult            
Shift+F4            Focus Previous Search Resultsearch.action.focusPreviousSearchResult            
Down            Show Next Search Termhistory.showNext            
Up            Show Previous Search Termhistory.showPrevious            

Preferences

KeyCommandCommand id
Ctrl+,            Open Settingsworkbench.action.openSettings            
unassigned            Open Workspace Settingsworkbench.action.openWorkspaceSettings            
Ctrl+K Ctrl+S            Open Keyboard Shortcutsworkbench.action.openGlobalKeybindings            
unassigned            Open User Snippetsworkbench.action.openSnippets            
Ctrl+K Ctrl+T            Select Color Themeworkbench.action.selectTheme            
unassigned            Configure Display Languageworkbench.action.configureLocale            

Debug

KeyCommandCommand id
F9            Toggle Breakpointeditor.debug.action.toggleBreakpoint            
F5            Startworkbench.action.debug.start            
F5            Continueworkbench.action.debug.continue            
Ctrl+F5            Start (without debugging)workbench.action.debug.run            
F6            Pauseworkbench.action.debug.pause            
F11            Step Intoworkbench.action.debug.stepInto            
Shift+F11            Step Outworkbench.action.debug.stepOut            
F10            Step Overworkbench.action.debug.stepOver            
Shift+F5            Stopworkbench.action.debug.stop            
Ctrl+K Ctrl+I            Show Hovereditor.debug.action.showDebugHover            

Tasks

KeyCommandCommand id
Ctrl+Shift+B            Run Build Taskworkbench.action.tasks.build            
unassigned            Run Test Taskworkbench.action.tasks.test            

Extensions

KeyCommandCommand id
unassigned            Install Extensionworkbench.extensions.action.installExtension            
unassigned            Show Installed Extensionsworkbench.extensions.action.showInstalledExtensions            
unassigned            Show Outdated Extensionsworkbench.extensions.action.listOutdatedExtensions            
unassigned            Show Recommended Extensionsworkbench.extensions.action.showRecommendedExtensions            
unassigned            Show Popular Extensionsworkbench.extensions.action.showPopularExtensions            
unassigned            Update All Extensionsworkbench.extensions.action.updateAllExtensions            

Next steps

Now that you know about our Key binding support, what's next...

  • Language Support - Our Good, Better, Best language grid to see what you can expect

  • Debugging - This is where VS Code really shines

  • Node.js - End to end Node.js scenario with a sample app

Common questions

How can I find out what command is bound to a specific key?

In the Keyboard Shortcut editor, you can filter on specific keystrokes to see which commands are bound to which keys. Below you can see that Ctrl+Shift+P is bound to Show All Commands to bring up the Command Palette.

Key bindings quick outline

How to add a key binding to an action? For example, add Ctrl+D to Delete Lines

Find a rule that triggers the action in the Default Keyboard Shortcuts and write a modified version of it in your keybindings.json file:

// Original, in Default Keyboard Shortcuts
{ "key": "ctrl+shift+k",          "command": "editor.action.deleteLines",
                                     "when": "editorTextFocus" },
// Modified, in User/keybindings.json, Ctrl+D now will also trigger this action
{ "key": "ctrl+d",                "command": "editor.action.deleteLines",
                                     "when": "editorTextFocus" },


How can I add a key binding for only certain file types?

Use the editorLangId context key in your when clause:

{ "key": "shift+alt+a",           "command": "editor.action.blockComment",
                                     "when": "editorTextFocus && editorLangId == csharp" },


I have modified my key bindings in keybindings.json, why don't they work?

The most common problem is a syntax error in the file. Otherwise, try removing the when clause or picking a different key. Unfortunately, at this point, it is a trial and error process.


来自 https://code.visualstudio.com/docs/getstarted/keybindings




VS Code 的常用快捷键

VS Code 的常用快捷键和插件        

一、vs code 的常用快捷键        

1、注释        

  a) 单行注释:[ctrl+k,ctrl+c] 或 ctrl+/        

  b) 取消单行注释:[ctrl+k,ctrl+u] (按下ctrl不放,再按k + u)        

  c) 多行注释:[alt+shift+A]        

  d) 多行注释:/**        

2、移动行:alt+up/down        

3、显示/隐藏左侧目录栏  ctrl + b        

4、复制当前行 (向下复制行) :shift + alt +up/down        

5、删除当前行 (删除一行) (删除行):shift + ctrl + k    ;;;;;;;;;;我改成了  ctrl+shift+d              # deletelines        

6、控制台终端显示与隐藏:ctrl + ~        

7、查找文件/安装vs code 插件地址:ctrl + p        

         

8、代码格式化:shift + alt +f        

9、新建一个窗口 : ctrl + shift + n        

10、行增加缩进:  ctrl + [        

11、行减少缩进:  ctrl + ]        

12、裁剪尾随空格(去掉一行的末尾那些没用的空格) : ctrl + shift + x        

13、字体放大/缩小:  ctrl + ( + 或 - )        

14、拆分编辑器 :  ctrl + 1/2/3        

15、切换窗口 :  ctrl + shift + left/right        

16、关闭编辑器窗口 :  ctrl + w        

17、关闭所有窗口 :  ctrl + k + w        

18、切换全屏 :   F11        

19、自动换行 :  alt + z        

20、显示git  :   ctrl + shift + g        

21、全局查找文件:ctrl + shift + f        

22、显示相关插件的命令(如:git log):ctrl + shift + p        

23、选中文字:shift + left / right / up / down        

24、折叠代码: ctrl + k + 0-9 (0是完全折叠)        

25、展开代码: ctrl + k + j (完全展开代码)        

26、删除行 : ctrl + shift + k         

27、快速切换主题:ctrl + k / ctrl + t        

28、快速回到顶部 : ctrl + home        

29、快速回到底部 : ctrl + end        

30、格式化选定代码 :ctrl + k / ctrl +f        

31、选中代码 : shift + 鼠标左键        

32、多行同时添加内容(光标) :ctrl + alt + up/down        

33、全局替换:ctrl + shift + h        

34、当前文件替换:ctrl + h        

35、打开最近打开的文件:ctrl + r        

36、打开新的命令窗:ctrl + shift + c        

37、vs code 中git提交默认不区分文件名大小写:  git config core.ignorecase false        

         

二、vs code 的常用插件        

1、Auto Rename Tag   修改html标签,自动帮你完成尾部闭合标签的同步修改,和webstorm一样。        

2、Auto Close Tag   自动闭合HTML标签        

4、Beautiful   格式化代码的工具        

5、Dash   Dash是MacOS的API文档浏览器和代码段管理器        

6、Ejs Snippets  ejs 代码提示        

7、ESLint   检查javascript语法错误与提示        

8、File Navigator  快速查找文件        

9、Git History(git log)   查看git log        

10、Gulp Snippets   写gulp时用到,gulp语法提示。        

11、HTML CSS Support   在HTML标签上写class智能提示当前项目所支持的样式        

12、HTML Snippets   超级好用且初级的H5代码片段以及提示        

13、Debug for Chrome   让vs code映射chrome的debug功能,静态页面都可以用vscode来打断点调试、配饰稍微复杂一点        

14、Document this         Js的注释模板        

15、jQuery Code Snippets   jquery提示工具        

16、Html2jade   html模板转pug模板
       

17、JS-CSS-HTML Formatter  格式化        

18、Npm intellisense   require 时的包提示工具        

19、Open in browser  打开默认浏览器        

20、One Dark Theme  一个vs code的主题        

21、Path Intellisense   自动路径补全、默认不带这个功能        

22、Project Manager   多个项目之间快速切换的工具        

23、Pug(Jade) snippets   pug语法提示        

24、React Components   根据文件名创建反应组件代码。        

25、React Native Tools    reactNative工具类为React Native项目提供了开发环境。        

26、Stylelint   css/sass代码审查        

27、Typings auto installer   安装vscode 的代码提示依赖库,基于typtings的        

28、View In Browser   默认浏览器查看HTML文件(快捷键Ctrl+F1可以修改)        

29、Vscode-icons  让vscode资源目录加上图标、必备        

30、VueHelper   Vue2代码段(包括Vue2 api、vue-router2、vuex2)        

31、Vue 2 Snippets   vue必备vue代码提示        

32、Vue-color   vue语法高亮主题        

33、Auto-Open Markdown Preview markdown文件自动开启预览        

34、EverMonkey 印象笔记        

35、atom one dark atom的一个高亮主题(个人推荐)        

         

三、常用的电脑快捷键        

1、ctrl + shift + delete 快速清除浏览器缓存        

2、ctrl + alt + delete  快速进入任务管理器页面        

3、window + L  快速锁定电脑        

4、window + d  所有窗口最小化        

5、 window + e  打开我的资源管理器(我的电脑)        

6、 window + f  快速打开搜索窗口        

7、 alt + tab  快速查看打开的应用与窗口        

标签:


来自   https://www.cnblogs.com/weihe-xunwu/p/6687000.html



一步步 扩选  extends expand (扩大选择 扩大选中)  html 标签  菜单=>首选项=> 键盘快捷键=>Emmet:Balance(outward)

image.png











普通分类: