Table of Contents
0. Start VS Code from the command line
1. Search for the file and open it.
2. Select all matches at once and modify them at once
3. Select the matched ones one by one and modify them all at once
4. Undoing the previous selected match is the reverse operation of shortcut key 3
5. Select the entire line
6. Jump to the specified line
7. Close all open tabs
#8. Block comments.
9. Fold/expand code.
10. Move rows
11. Open the terminal
12. Split window
13. Formatting documents
14. Copy the selected content to the bottom or above
15. Open or hide the sidebar
Finally
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)

Nov 18, 2021 pm 06:46 PM
vscode shortcut key

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to define header files for vscode How to define header files for vscode Apr 15, 2025 pm 09:09 PM

How to define header files using Visual Studio Code? Create a header file and declare symbols in the header file using the .h or .hpp suffix name (such as classes, functions, variables) Compile the program using the #include directive to include the header file in the source file. The header file will be included and the declared symbols are available.

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

How to solve the problem of vscode Chinese annotations becoming question marks How to solve the problem of vscode Chinese annotations becoming question marks Apr 15, 2025 pm 11:36 PM

How to solve the problem that Chinese comments in Visual Studio Code become question marks: Check the file encoding and make sure it is "UTF-8 without BOM". Change the font to a font that supports Chinese characters, such as "Song Style" or "Microsoft Yahei". Reinstall the font. Enable Unicode support. Upgrade VSCode, restart the computer, and recreate the source file.

How to use VSCode How to use VSCode Apr 15, 2025 pm 11:21 PM

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages ​​and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version

Common commands for vscode terminal Common commands for vscode terminal Apr 15, 2025 pm 10:06 PM

Common commands for VS Code terminals include: Clear the terminal screen (clear), list the current directory file (ls), change the current working directory (cd), print the current working directory path (pwd), create a new directory (mkdir), delete empty directory (rmdir), create a new file (touch) delete a file or directory (rm), copy a file or directory (cp), move or rename a file or directory (mv) display file content (cat) view file content and scroll (less) view file content only scroll down (more) display the first few lines of the file (head)

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

Where to write code in vscode Where to write code in vscode Apr 15, 2025 pm 09:54 PM

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

How to switch Chinese mode with vscode How to switch Chinese mode with vscode Apr 15, 2025 pm 11:39 PM

VS Code To switch Chinese mode: Open the settings interface (Windows/Linux: Ctrl, macOS: Cmd,) Search for "Editor: Language" settings Select "Chinese" in the drop-down menu Save settings and restart VS Code

See all articles