There are too many shortcuts in vscode to be dazzling, but we only need to remember a few commonly used shortcuts to improve development efficiency, so summarize them and bold them to help improve efficiency.
1. Main Command Box
F1 or Ctrl+Shift+P (commonly known as the omnipotent key): Open the command panel. In the open input box, you can enter any command
Ctrl+P:
Click Backspace to enter Ctrl+P Go mode
Enter > under Ctrl+P to enter Ctrl+Shift+P mode
You can also enter a file name directly under the Ctrl+P window and jump to the file
Entering "?" in Ctrl+P mode will pop up the drop-down menu
Symbol | Effect |
---|---|
? | List current actions that can be executed |
! | Display Errors or Warnings, or Ctrl+Shift+M |
: | Jump to the number of lines, or Ctrl+G directly |
@ | Jump to symbol (search for variables or functions), or Ctrl+Shift+O directly |
@ | Jump symbol s by category, find attributes or functions, or enter':'after Ctrl+Shift+O |
# | Find a symbol by name, or Ctrl+T |
2. Code Editor
2.1 Code format correlation
Shortcut keys | Effect |
---|---|
Ctrl+[, Ctrl+] | Code line indentation |
Ctrl+Shift+[, Ctrl+Shift+] | Collapse Open Code Block |
Ctrl+C Ctrl+V | Copy and paste, or copy and paste a line if no text is selected |
Shift+Alt+F | Formatter |
Alt+Up,Alt+Down | Move up and down a line |
Shift+Alt+Up,Shift+Alt+Down | Copy a row up and down |
Ctrl+Shift+Enter | Insert a row above the current row (cursor moves to the new row after insertion) |
2.2 Cursor correlation
Shortcut keys | Effect |
---|---|
Ctrl+Shift+L | Select all matches |
Ctrl+D | Check Match |
Ctrl+U | Cursor Return |
Alt+Shift+Left Mouse Key | Multi-line editing (column editing) |
Shift+End | Select from cursor to end of line |
Shift+Home | Select from the beginning of the line to the cursor |
Home | Move to the beginning of the line: |
End | Move to End of Line |
F12 | Move to Definition |
Alt+F12 | View thumbnails at definitions (just take a look without jumping around) |
Ctrl+Delete | Delete everything to the right of the cursor (current line) |
Shift+Alt+Right and Shift+Alt+Left | Expand/Reduce Selection |
2.3 Refactoring Code
Find all references: Shift+F12
Also modify all matches in this file: Ctrl+F2
Jump to the next Error or Warning: You can press F8 to jump one by one when there are multiple errors
3. Show correlation
Zoom in or out (based on the top left corner of the editor): Ctrl +/-
Sidebar Show or Hide: Ctrl+B
Display Explorer (cursor cut to sidebar only works): Ctrl+Shift+E
Show Debug: Ctrl+Shift+D
Show Output: Ctrl+Shift+U
4. Modify default shortcuts
Method 1: Open the default keyboard shortcut settings: File -> Preferences -> Keyboard Shortcuts (when Chinese interface is:'File'->'Preferences'->'Keyboard Shortcuts'), or Alt+F -> P -> K -> Enter
Method 2: Click "keybindings.json" at the bottom of the search bar to enter the editing interface
There is a certain way to write the corresponding rules, as follows:
// Put key bindings in this file to override defaults [{ "key": "f8", "command": "workbench.action.tasks.runTask", "args": "build", "when": "editorTextFocus" } ] key A key representing a binding command Represents an executed command args The parameters of the command, where we are build Compile Task when When the shortcut key takes effect, this refers to the edit area Save, you try to press F8,The task ran smoothly.
A blogger's "keybindings.json" file is referenced below (use with caution):
// Place your key bindings in this file to overwrite the defaults [ // ctrl+space occupied by toggle input method shortcuts { "key": "ctrl+alt+space", "command": "editor.action.triggerSuggest", "when": "editorTextFocus" }, // ctrl+d deletes a row { "key": "ctrl+d", "command": "editor.action.deleteLines", "when": "editorTextFocus" }, // Interchange with shortcut key to delete a line { "key": "ctrl+shift+k", "command": "editor.action.addSelectionToNextFindMatch", "when": "editorFocus" }, // ctrl+shift+/multiline comment { "key":"ctrl+shift+/", "command": "editor.action.blockComment", "when": "editorTextFocus" }, // Customize the same case conversion shortcuts as sublime 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" } ]
Don't forget that station b pays attention to what Jiaran eats today, the Evening Devil, Bela kira, Nayline Queen, Carol~