Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commonly used shortcut keys for VSCode

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about the keyboard shortcuts commonly used in VSCode. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Visual Studio Code is a powerful editor that starts very fast and can be used to replace other text file editing tools. Can also be used to do development, support a variety of languages, compared to other IDE, lightweight fully configurable and integrated Git feel very suitable for front-end development. So I studied carefully that the document might be used as a main tool in the future.

1. Main command box

The most important function is the command panel opened by F1 or Ctrl+Shift+P, where you can execute any VSCode command or even close the editor.

Click Backspace to enter Ctrl+P mode

Enter > under Ctrl+P to return to Ctrl+Shift+P mode.

It's OK under the Ctrl+P window.

● directly enters the file name and jumps to the file

●? List the actions that can currently be performed

●! Display Errors or Warnings, or `Ctrl+Shift+M

●: jump to the number of lines, or you can enter Ctrl+G directly

● @ jumps to symbol (search variable or function), or you can enter Ctrl+Shift+O directly

● @: jump to symbol according to the category to find attributes or functions, or enter: enter after Ctrl+Shift+O

● # look up symbol by name, or Ctrl+T

2. Common shortcut keys

Editor and window Management

Open multiple windows at the same time (view multiple projects)

● opens a new window: Ctrl+Shift+N

● close window: Ctrl+Shift+W

Open multiple editors at the same time (view multiple files)

● New File Ctrl+N

Switch Ctrl+Tab between ● files

● cuts out a new editor (up to 3) Ctrl+\, or you can hold down the Ctrl mouse and click the file name in Explorer.

The shortcut key Ctrl+1 Ctrl+2 Ctrl+3 of the left, middle and right three editors of ●

● cycle between the three editors to switch Ctrl+ `

Change the ● editor, Ctrl+k and press Left or Right

Code editing

Format adjustment

● line indentation Ctrl+ [Ctrl+]

If ● Ctrl+C Ctrl+V is not selected, a whole line is copied or cut by default

● code format: Shift+Alt+F, or enter format code after Ctrl+Shift+P

● moves up and down one line: Alt+Up or Alt+Down

● copies one line up and down: Shift+Alt+Up or Shift+Alt+Down

● inserts a row of Ctrl+Enter below the current line

● inserts a row of Ctrl+Shift+Enter above the current line

Cursor correlation

● moves to the beginning of the line: Home

● moves to the end of the line: End

● moves to the end of the file: Ctrl+End

● moves to the beginning of the file: Ctrl+Home

● moves to definition: F12

● definition thumbnail: take a look without jumping to Alt+F12

● moves to the last half of the parenthesis Ctrl+Shift+]

● selects Shift+End from cursor to end of line

● selects Shift+Home from the beginning of the line to the cursor

● deletes all words Ctrl+Delete to the right of the cursor

● Shrink/expand selection: Shift+Alt+Left and Shift+Alt+Right

● Multi-Cursor: you can select multiple places in succession and modify them together. Add cursor or Ctrl+Alt+Down or Ctrl+Alt+Up to Alt+Click.

● selects all matching Ctrl+Shift+L at the same time

The next match of ● Ctrl+D is also selected (I customized to delete the current line, see Ctrl+Shift+K below)

● rollback the previous cursor operation Ctrl+U

Refactoring code

● found all references: Shift+F12

● also modifies all matches in this file: Ctrl+F12

● rename: for example, to change a method name, you can select it and press F2, enter the new name, enter, and you will find that all the files have been modified.

● jumps to the next Error or Warning: you can press F8 to jump one by one when there are multiple errors

● View diff right-click Set file to compare on the file in explorer, then right-click on the file you need to compare and select Compare with 'file_name_you_chose'.

Find and replace

● finds Ctrl+F

● find and replace Ctrl+H

● look for Ctrl+Shift+F in the entire folder

Match character:

○ * 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 correlation

● full screen: F11

● zoomIn/zoomOut:Ctrl + = / Ctrl +-

● sidebar show / hide: Ctrl+B

The 4 functions of ● sidebar show:

○ Show Explorer Ctrl+Shift+E

○ Show SearchCtrl+Shift+F

○ Show GitCtrl+Shift+G

○ Show DebugCtrl+Shift+D

● Show OutputCtrl+Shift+U

Other

● auto-save: File-> AutoSave, or Ctrl+Shift+P, enter auto

3. Modify the default shortcut key

File-> Preferences-> Keyboard Shortcuts

Modify keybindings.json, and mine is shown here C:\ Users\ Administrator\ AppData\ Roaming\ Code\ User\ keybindings.json

/ / Place your key bindings in this file to overwrite the defaults [/ / ctrl+space is occupied by switching input method shortcuts {"key": "ctrl+alt+space", "command": "editor.action.triggerSuggest", "when": "editorTextFocus"}, / / ctrl+d deletes a line {"key": "ctrl+d", "command": "editor.action.deleteLines" "when": "editorTextFocus"}, {"key": "ctrl+shift+k", / / exchanged with the shortcut key for deleting a line:) "command": "editor.action.addSelectionToNextFindMatch", "when": "editorFocus"}, / / ctrl+shift+/ multiline comments {"key": "ctrl+shift+/", "command": "editor.action.blockComment" "when": "editorTextFocus"}]

4. Plug-in

The new version supports plug-ins installed

Plug-in Market https://marketplace.visualstudio.com/#VSCode

Install the plug-in

F1 input extensions

Click the first to start the installation or upgrade, or you can enter Ctrl+P by typing ext install

Clicking the second will list the installed extensions, from which you can uninstall

Thank you for reading! This is the end of this article on "what shortcuts are commonly used in VSCode". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report