Home > Development Tools > VSCode > Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

青灯夜游
Release: 2021-11-22 19:52:52
forward
5552 people have browsed it

The following vscode column will share with you some super invincible and practical vscode shortcut keys. Familiarity with vscode shortcut keys can improve efficiency. I hope it will be helpful to friends in need!

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

VS Code is a very popular editor in the programming field. Whether I am writing Vue, Python, Java, or MarkDown, I will use it for editing. Of course , and will also use its Vim plug-in. When writing code, it is often used to format the code. Although many operations can be performed through buttons on the menu, if you want to improve efficiency, you still need to remember its shortcut keys. [Recommended study: "vscode introductory tutorial"]

Here are 15 shortcut keys that I often use, which can greatly improve your editing efficiency, as follows:

0. Start VS Code from the command line

First install the code command in VS Code, start VS Code, press the shortcut key Command Shift p (Mac, if it is Win or Linus, it is Ctrl Shift p), and enter shell Select this installation code command, as shown in the figure below:

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

Then, if you want to use VS Code to open the current directory, you can execute it in the terminal:

code .
Copy after login

When This is useful when you are using the terminal and want to open a directory in VS Code. You can also code {path} to open the corresponding path.

1. Search for the file and open it.

Shortcut keys:

  • Mac: Command p
  • Windows/Linux: Ctrl p

Between files Navigation is a very common requirement. While editing one file, another file needs to be modified simultaneously. At this time, the most efficient way is to type the file name to perform a fuzzy search and then press Enter to open it. Press this shortcut key and then enter the file name and press Enter. Opening the corresponding file is much faster than selecting it with the mouse.

2. Select all matches at once and modify them at once

Shortcut key:

  • Mac: Command shift l
  • Windows/Linux: Ctrl shift l

First select or search for the content that needs to be modified, and then press the shortcut key, all matching content will be Selecting and then modifying it is equivalent to modifying all matching content. There is no need to copy and search and replace first. What you see is what you get, which is very convenient.

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

3. Select the matched ones one by one and modify them all at once

Shortcut key:

  • Mac: Command d
  • Windows/Linux: Ctrl d

First select or search for the content that needs to be modified, then press this shortcut key, the first matching content will be selected, and then Press once and the next matching content will be added until the content you need to modify is selected, and then modifying it is equivalent to modifying all the selected content. Compared with the previous content, you can freely choose what you want. The matching content range.

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

4. Undoing the previous selected match is the reverse operation of shortcut key 3

Shortcut key:

  • Mac: Command u
  • Windows/Linux: Ctrl u

When you select multiple matching contents, you can press this shortcut key to cancel the selection, yes The reverse operation of shortcut key 3.

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

5. Select the entire line

Shortcut key:

  • Mac: Command l
  • Windows/Linux: Ctrl l

This is very similar to Vim's Visual mode. Press v and then j to select a whole line of text.

Press this shortcut key to select the entire content of the line where the cursor is located, and press it again to append the next line.

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

6. Jump to the specified line

Shortcut key:

  • Mac: Ctrl g
  • Windows/Linux: Ctrl g

This shortcut key conflicts with the Vim plug-in. After all, it is too simple for Vim to jump to a specified line: in command mode, just colon and line number can jump. .

Press this shortcut key, enter the line number and press Enter to jump to the corresponding line number.

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

7. Close all open tabs

Shortcut keys:

  • Mac: Command k w
  • Windows/Linux: Ctrl k w

If you open too many files, a lot of tab pages will be generated just like a browser. If you want to close them all, just press this shortcut key, and then the entire editor will be refreshed.

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

#8. Block comments.

Shortcut keys:

  • Mac: Shift Option a
  • Windows: Shift Alt a
  • Linux: Ctrl Shift a

This is very simple, just select a piece of code and press the shortcut key to comment out the code as a block comment.

9. Fold/expand code.

Collapse shortcut key (left bracket):

  • Mac: Command Option [
  • Windows/Linux: Ctrl Shift [

Expand shortcut keys (left bracket):

  • Mac: Command Option ]
  • Windows/Linux: Ctrl Shift ]

10. Move rows

Shortcut keys

  • Mac: Option up/down
  • Windows/Linux: Alt up/down

11. Open the terminal

Shortcut keys

  • Mac: Ctrl `
  • Windows/Linux: Ctrl `

12. Split window

Shortcut keys

  • Mac: Command \
  • Windows/Linux: Ctrl \

The split window can compare files or different locations of the same file, which is very convenient for programming.

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

13. Formatting documents

Shortcut keys

  • Mac: Shift Option f
  • Windows: Shift Alt f
  • Linux: Ctrl Shift i

Usually we enable extensions or configuration settings to format documents on save, but sometimes we like to control when we want to Format the document. That's where this command comes in. It allows us to format the current document according to the configured settings.

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

14. Copy the selected content to the bottom or above

Shortcut keys

  • Mac: Option Shift up/down
  • Windows/Linux: Shift Alt up/down

Use this command to copy the selected code above or below the current code. For example, when the functions of two functions are almost the same, you can use it to quickly copy it below, and then make some modifications to turn it into a new function.

15. Open or hide the sidebar

Shortcut keys

  • Mac: Command b
  • Windows/Linux:

You can use this command to switch the sidebar so that you have more screen space when looking at the code.

Summary and sharing of 15 super practical vscode shortcut keys (quick collection)

Finally

This article introduces 15 common and efficient VS Code shortcut keys, which can greatly improve your coding efficiency. Of course, there are other useful shortcuts, such as Command Shift f (Mac) to search the contents of a file, Command Shift p to search for commands, command / to toggle line comments, and more.

Thanks for reading. I’m here to ask for attention again. If you think the content is good, please follow it or share it with your friends. Thank you for your support.

For more related knowledge about VSCode, please visit: vscode tutorial! !

The above is the detailed content of Summary and sharing of 15 super practical vscode shortcut keys (quick collection). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:juejin.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template