Official shortcut key list: https://code.visualstudio.com/docs/customization/keybindings
Visual Studio Code is an awesome editor, and it is very easy to start. It is fast and can be used to replace other text file editing tools. It can also be used for development and supports various languages. Compared with other IDEs, it is lightweight, fully configurable and integrates Git, making it very suitable for front-end development. So I took a closer look at how the document might be used as a main tool in the future.
1. Main command box
The most important function is F1
Ctrl Shift POpen the command panel. In this command box, you can execute any command of VSCode or even close the editor.
Click Backspace
Ctrl P
Enter under Ctrl P
>
You can return to Ctrl Shift P
In the Ctrl P
● Directly enter the file name and jump to the file
●? List the currently executable actions
● ! To display Errors or Warnings, you can also use `Ctrl Shift M
● : Jump to the line number, or you can use Ctrl G to directly enter
● @ Jump to symbol (search for variables or functions), you can also press Ctrl Shift O to enter
2, common shortcut keys
Editor and window Management
Open multiple windows at the same time (view multiple projects)●Open a new window: Ctrl Shift N
●Close the window: Ctrl Shift W
Open multiple editors at the same time (view multiple files)●Create a new file Ctrl N
● Switch between files Ctrl Tab
● Cut out a new editor (up to 3) Ctrl \, you can also hold down Ctrl and click the file name in Explorer
● Left, middle, right The shortcut keys for the 3 editors are Ctrl 1 Ctrl 2 Ctrl 3
● Switch between the 3 editors Ctrl `
● The editor changes position, Ctrl k and then press Left or Right
Code editing
Format adjustment● Code line indentation Ctrl [ Ctrl ]
● Ctrl C Ctrl V If not selected, copy or cut an entire line by default
● Code formatting: Shift Alt F, or Ctrl Shift P followed by format code
●●Insert a line above the current line Ctrl Shift Enter
Cursor related● Move to the beginning of the line: Home
● Move to the end of the line: End
● Move to the end of the file: Ctrl End
● Move to the beginning of the file: Ctrl Home
● Move to the definition: F12
● Definition Thumbnail: Just take a look without jumping to the past Alt F12
● Move to the last half bracket Ctrl Shift ]
● Select from the cursor to the end of the line Shift End
●●Select from the beginning of the line to the cursor Shift Home
●●Delete all words to the right of the cursor Ctrl Delete
●●Shrink/expand selection: Shift Alt Left and Shift Alt Right
●Multi-Cursor: You can select multiple places continuously and then modify them together. Alt Click to add cursor or Ctrl Alt Down or Ctrl Alt Up
● Select all matching Ctrl Shift L
Refactor the code
● Find all references: Shift F12
● Modify all matching ones in this file at the same time: Ctrl F12
● Rename: e.g. To modify the name of a method, you can press F2 after selecting it, enter the new name, and press Enter. You will find that all files have been modified.
●Jump to the next Error or Warning: When there are multiple errors, you can press F8 to jump one by one
●To view the diff, right-click the file in the explorer and select Set file to compare, then you need Right-click on the compared file and select Compare with 'file_name_you_chose'.
Find and Replace● Find Ctrl F
● Find and Replace Ctrl H
● Search in the entire folder Ctrl Shift F
○ * to match one or more characters in a path segment
○ ? to match on one character in a path segment
○ ** to match any number of path segments ,including none
○ {} to group conditions (e.g. {**/*.html,**/*. txt} matches all html and txt files)
○ [] to declare a range of characters to match (e.g., example.[0-9] to match on example.0,example.1, …
Show related
●Full screen: F11
●zoomIn/zoomOut: Ctrl =/Ctrl -
● Sidebar show/hide: Ctrl B
● Sidebar Column 4 major function display:
● Show OutputCtrl Shift U
Others
●Auto save: File -> AutoSave, or Ctrl Shift P, enter auto
3. Modify the default shortcut keys
##File -> Preferences -> Keyboard ShortcutsModifykeybindings.jsonC:\Users\Administrator\AppData\Roaming\Code\User\keybindings.json
// Place your key bindings in this file to overwrite the defaults
[
//ctrl+space被切换输入法快捷键占用
{
"key": "ctrl+alt+space",
"command": "editor.action.triggerSuggest",
"when": "editorTextFocus"
},
// ctrl+d删除一行
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+k", //与删除一行的快捷键互换了:)
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
//ctrl+shift+/多行注释
{
"key":"ctrl+shift+/",
"command": "editor.action.blockComment",
"when": "editorTextFocus"
}
]
4, plug-in
The new version supports plug-in installationPlug-in market https://marketplace.visualstudio.com/#VSCodeInstall plug-in
F1extensions
Ctrl Pext install
The above is the detailed content of VSCode common shortcut keys worth collecting. For more information, please follow other related articles on the PHP Chinese website!