The main command box

F1 or Ctrl+Shift+P: Opens the command panel. In the open input box, you can enter any command, as shown in the picture below (if the picture is too large to view clearly, you can right click “Open picture in New TAB” to view the original picture, the same below) :



Such as:

  • Pressing Backspace takes you into Ctrl+P mode
  • To enter Ctrl+Shift+P mode, type > under Ctrl+P
  • In the Ctrl+P window, you can directly enter the file name to jump to the file
  • Enter “? “in Ctrl+P mode. A drop-down menu will pop up, as shown below:

  • Common ones are as follows:
? List the current actions that can be performed! Display Errors or Warnings, or Ctrl+Shift+M: Jump to the number of lines, or Ctrl+G directly into @ jump to symbol (search variables or functions), or Ctrl+Shift+O directly into @ jump to symbol according to the classification, search attributes or functions, or Ctrl+Shift+O after input":"Enter theFind symbol by name (Ctrl+T
Copy the code

Two, common shortcut keys

1. Editor and window management

New File: Ctrl+N To switch between files: Ctrl+Tab to open a new VS Code editor: Ctrl+Shift+N to close the current window: Ctrl+W to close the current VS Code editor: Ctrl+Shift+W Cuts out a new editor window (up to 3): Ctrl+\ Toggle 3 editor Windows left, middle and right shortcut keys: Ctrl+1 Ctrl+2 Ctrl+3Copy the code

2. Code editing

(1) Format adjustment

Indent line left or right: Ctrl+[, Ctrl+] Copy or cut current line/selected content: Ctrl+C, Ctrl+V Format code: Shift+Alt+F Move a line Up or Down: Alt+Up or Alt+Down Copy a line Up or Down: Shift+Alt+Up or Shift+Alt+Down Inserts a line below the current line: Ctrl+Enter Inserts a line above the current line: Ctrl+Shift+EnterCopy the code

(2) Cursor correlation

Move to top of line: Home move to End of line: End Move to End of file: Ctrl+End Move to top of file: Ctrl+Home Move to definition: F12 View thumbnail image at definition (just look at it without skipping to it): Alt+F12 Select content from cursor to End of line: Shift+End Selects everything from the cursor to the beginning of the line: Shift+Home Deletes everything to the Right of the cursor (current line): Ctrl+Delete Extends/shrinks the selection: Shift+Alt+Right and Shift+Alt+Left Multi-line editing (column editing): Alt+Shift+ left mouse button or Ctrl+Alt+Down/Up Select all matches at the same time edit (match current line or selected content): Ctrl+Shift+L The next match is also selected: Ctrl+D Rewind previous cursor action: Ctrl+U Undo previous action: Ctrl+Z Manual save: Ctrl+SCopy the code

(3) Refactor the code

Find all references: Shift+F12 modify all matches in this file at the same time: Ctrl+F2 jump to the next Error or Warning: When there are multiple errors, press F8 to jump to one by oneCopy the code

(4) Find replacements

Find: Ctrl+F Find replace: Ctrl+HCopy the code

(5) Display correlation

Full screen display (press again to restore): F11 Zoom in or out (based on the top left corner of the editor): Ctrl+ /- Sidebar Show or hide: Ctrl+B Shows Explorer (only when the cursor is moved to the sidebar): Ctrl+Shift+E Shows search (only when the cursor is moved to the sidebar): Debug: Ctrl+Shift+D Output: Ctrl+Shift+UCopy the code

(6) Other Settings

  • Auto save: File -> AutoSave or Ctrl+Shift+P, enter Auto

3. Modify the default shortcut keys

  • Open the default Keyboard Shortcuts: File -> Preferences -> Keyboard Shortcuts(For English: File -> Preferences -> Keyboard Shortcuts), or: Alt+F -> p -> k -> Enter, as shown in Figure 1 below.
  • Modify shortcut key binding method 1: Directly click on the line corresponding to the command, the pen-shaped icon will appear, and click to enter the modification, as shown in Figure 1 below:

  • Method 2: Click “Keybinding. json” at the bottom of the search bar to enter the editing interface, as shown below:

  • There are certain methods to write corresponding rules, as follows:
// Place the key bindings in this file to override the default values [{"key": "f8"."command": "workbench.action.tasks.runTask"."args": "build"."when": "editorTextFocus"}] key indicates the bound keycommandWhen the shortcut key is in effect. When the edit area is saved, you try to press F8 and the task will run successfully.Copy the code
  • The reference “keybinding. json” file is as follows (use with caution) :
// Place your key bindings inThis file to overwrite the defaults [// CTRL +space]"key": "ctrl+alt+space"."command": "editor.action.triggerSuggest"."when": "editorTextFocus"}, // CTRL +d delete a line {"key": "ctrl+d"."command": "editor.action.deleteLines"."when": "editorTextFocus"}, // Interchangeable with delete line shortcut {"key": "ctrl+shift+k"."command": "editor.action.addSelectionToNextFindMatch"."when": "editorFocus"
    },
    // ctrl+shift+/ multi-line comment {"key":"ctrl+shift+/"."command": "editor.action.blockComment"."when": "editorTextFocus"} / / customized shortcuts and sublime does same case conversion editor. Action. TransformToLowercase editor. Action. TransformToUppercase {"key": "ctrl+k ctrl+u"."command": "editor.action.transformToUppercase"
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+k ctrl+l"."command": "editor.action.transformToLowercase"
        "when": "editorTextFocus"}]Copy the code

More references

  • Lzw. me/a/vscode-vi…
  • The official shortcuts: code.visualstudio.com/docs/getsta…