Home > Article > Development Tools > Memorize these VSCode shortcuts to improve your development efficiency!
This article summarizes some VSCode shortcuts recorded in official documents that can improve efficiency. Memorize them to improve development efficiency! !
Visual Studio Code is one of the most popular and commonly used code editors. It is open source and free to use. It also provides support for multiple languages and frameworks. [Recommended study: "vscode Getting Started Tutorial"]
Note that these Visual Studio Code shortcuts are taken from the VS Code official documentation. If some shortcuts don't work, it may be because the shortcut has changed in the editor or file format, or an extension has been installed that is affecting the shortcut.
When you need to search for specific files, and when the project is large, it will take a lot of time. Even if you already know where the file is, using this shortcut key will be very convenient to easily open the file in the project.
Visual Studio Code has many features and settings that can be changed as needed. This shortcut makes it easy to open settings when necessary.
Many times, we need more space to place the files we need to process. Therefore, this shortcut key can conveniently show or hide the sidebar.
When you have many tabs open and need to switch between them, you can use this shortcut key, it will display the tab list and navigate between them, we can select the tab to open.
Visual Studio Code provides the function of creating a tab group. Tab groups allow us to group tabs, each taking up a portion of the screen. Use this shortcut key to switch between different tab groups. If the tab group selected in the shortcut is greater than the number of groups currently open, this shortcut creates a new group.
During the development process, the terminal will be used frequently. Visual Studio Code allows us to open a terminal window within the editor. This eliminates the need to switch between the editor and the terminal, allowing us to focus on the editor and code.
We can execute many commands in Visual Studio Code. Use this shortcut key to easily open the command palette. The command palette allows searching for available commands and executing them.
During the development process, it is often necessary to make selections in the code, including copying, cutting and other operations. Instead of using the mouse, you can save time by using the keyboard. These shortcut keys focus on making selections quickly.
You can use this shortcut key to quickly select the entire line of code in the line where the cursor is.
Use this shortcut key to only select the text you want to find once, and you can select all this text in the file, so that you can edit these texts at the same time.
This shortcut performs the same action as the shortcut above, but without selecting anything. When the cursor is placed on a word, press this shortcut key to select all positions of this word in the current file.
When you select a portion of the code, you can move and expand the selection of this shortcut. You can use the right or left arrow to go in the direction you want.
Drag the cursor over the code to select each line from beginning to end. But you can also use this shortcut to select partial lines of code, but only multiple lines of code you drag.
You can also perform the above operations using this shortcut key, but instead of using the mouse, use the arrow keys on the keyboard.
All editors have a search function so that you can search in the current file or multiple files Certain words, such as function or variable names, phrases, or code blocks, etc. Let’s take a look at the shortcut keys related to the search function.
You can use this shortcut key to move between search results in the file.
If you want to modify multiple search results, you can use this shortcut key to select multiple contents in the search results in the file. Each time you press this key, one result will be selected, and then you will press Search results are selected in order.
If you want to use the search function to modify all search results, this shortcut key can select all search results.
As a file or project becomes more complex, it becomes increasingly difficult to find certain parts of the code. It can be difficult to manually find errors or go to a certain line of code. The following shortcut keys can save a lot of trouble, allowing us to devote more time to what we really want to do.
When you encounter a specified line of code that causes a compilation or runtime error, you can use this shortcut key to jump to this line of code. Just press this Shortcut key, enter the number of lines of code, and press Enter to jump to this line of code. This shortcut is very useful when there is a lot of code in a file.
We may need to find the closing bracket of the matching code block. It's difficult when the file is long. Use this shortcut to easily find the closing matching bracket for the current block. In HTML tags, it can be moved to the end of the current tag.
When files contain a lot of code, we can collapse (hide) a certain code block that we are not currently focusing on so that we can focus on other content. This shortcut key is used to collapse or expand code blocks. Just click anywhere in the code block and press the following keys.
What if a code block contains sub-code blocks? Using the above command will collapse the parent code block, but when the parent code block is expanded, the child code block will remain unchanged. If you need to collapse and expand a code block and its sub-code blocks, you can use this shortcut to do it.
It is crucial to find the code where errors and warnings occur in your code. This shortcut saves you the trouble of scrolling to find the exact problem. It can go directly to the next error or warning.
In many cases, it may be necessary to have multiple cursors, each located at a different location in the file. These shortcuts make it easier to move around with multiple cursors.
This keyboard shortcut can insert an extra cursor anywhere in the file.
The second way to insert a cursor is to insert it above or below the current cursor position.
What if the cursor is inserted by mistake, or the cursor is no longer needed at that location? This shortcut undoes the last inserted cursor. This shortcut key is useful when inserting multiple cursors, as it keeps the other cursors in place and deletes the last inserted cursor.
Use this shortcut key to insert the cursor at the end of each line of selected code.
Many times you need to move one or more lines of code from one location to another. Instead of copying or cutting and pasting the code to another location, this shortcut provides a faster solution by simply placing the cursor over the line of code. If you want to move multiple lines of code, just select the code you want to move and then use this shortcut key.
What if you need to copy one or more lines of code and paste them below or above? Instead of actually copying and pasting the code, this shortcut copies the line below or above it depending on the direction you select with the arrows. If you want to copy multiple lines of code, just select the code to be copied and then use this shortcut key.
When copying code from one location to another, or when changing code, many times the code will have incorrect indentation. This shortcut allows you to indent the code as needed, or select multiple lines of code to move them together.
Use this shortcut key to comment or uncomment the line of code where the cursor is. If you want to comment or uncomment multiple lines of code, you only need to select the multiple lines of code first.
Different from the above shortcut keys, the following shortcut keys will comment the selected multiple lines of code into a single comment.
For readability reasons, it is important to maintain the format specified by the code. Visual Studio Code provides two shortcut commands for code formatting.
The following shortcut keys can format the code in the entire file:
The following shortcut keys can format the selected code:
In many cases, if a common or simple error, Visual Studio Code can fix it directly - such as a missing semicolon. If Quick Fix is available, this shortcut can quickly fix errors or warnings.
It is easy to make mistakes if you manually rename variables, functions or classes that are used multiple times. This shortcut provides a safe way to rename any symbol.
You can use the following shortcut keys to delete extra blank lines:
3. Switch suggestions
When writing code, VS Code or some extensions will display code suggestions. This shortcut lets you quickly toggle code suggestions to view or hide them. Windows/LinuxFor more knowledge about VSCode, please visit: vscode tutorial
! !The above is the detailed content of Memorize these VSCode shortcuts to improve your development efficiency!. For more information, please follow other related articles on the PHP Chinese website!