search
HomeDevelopment ToolsVSCodeMemorize 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! !

Memorize these VSCode shortcuts to improve your 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.

1. Quick Navigation

1. Search for files

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.

  • Windows/Linux: ctrl P
  • macOS: command P

2. Open settings

Visual Studio Code has many features and settings that can be changed as needed. This shortcut makes it easy to open settings when necessary.

  • Windows/Linux: ctrl ,
  • macOS: command ,

3. Switch side Sidebar

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.

  • Windows/Linux: ctrl B
  • macOS: command B

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.

  • Windows/Linux: ctrl shift tab
  • macOS: control shift tab

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.

  • Windows/Linux : ctrl 1 or 2 or 3
  • macOS: command 1 or 2 or 3

6. Open the terminal

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.

  • Windows/Linux: ctrl J
  • macOS: command J

Memorize these VSCode shortcuts to improve your development efficiency!

7. Open the command panel

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.

  • Windows/Linux: ctrl shift P
  • macOS: command shift P

Memorize these VSCode shortcuts to improve your development efficiency!

2. Quick selection

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.

1. Select the current line

You can use this shortcut key to quickly select the entire line of code in the line where the cursor is.

  • Windows/Linux: ctrl L
  • macOS: command L

2. Current selection

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.

  • Windows/Linux : ctrl shift L
  • macOS : command shift L

3. Current Word

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.

  • Windows/Linux: ctrl F2
  • macOS: command F2 fn

Memorize these VSCode shortcuts to improve your development efficiency!

4. Select until the end of the word

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.

  • Windows/Linux : shift alt → or ←
  • macOS : shift option → or ←

5. Select multiple lines of code by dragging the mouse

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.

  • Windows/Linux : shift alt drag the cursor
  • macOS : shift option drag the cursor

6. Use arrow keys to select multiple lines of code

You can also perform the above operations using this shortcut key, but instead of using the mouse, use the arrow keys on the keyboard.

  • Windows/Linux : ctrl shift alt → or ← or ↓ or ↑
  • macOS : command shift option → or ← or ↓ or ↑

Memorize these VSCode shortcuts to improve your development efficiency!

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.

1. Result Navigation

You can use this shortcut key to move between search results in the file.

  • Windows/Linux:F3
  • macOS:F3 fn

2. Select multiple Results

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.

  • Windows/Linux : ctrl D
  • macOS : command D

3. Select all results

If you want to use the search function to modify all search results, this shortcut key can select all search results.

  • Windows/Linux: alt enter
  • macOS: option enter

4. Code Navigation

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.

1. Jump to the specified line

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.

  • Windows/Linux: ctrl G
  • macOS: control G

Memorize these VSCode shortcuts to improve your development efficiency!

2. Go to the matching bracket

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.

  • Windows/Linux : ctrl shift \
  • macOS : command shift \

3. Collapse/expand code blocks

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.

  • Windows/Linux : ctrl shift [or]
  • macOS : command option [or]

4. Collapse/expand code blocks and sub-code blocks

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.

  • Windows/Linux : ctrl K [or]
  • macOS : command K [or]

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.

  • Windows/Linux:F8
  • macOS:F8 fn

5. Move the cursor

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.

1. Insert an extra cursor at a specific position

This keyboard shortcut can insert an extra cursor anywhere in the file.

  • Windows/Linux : alt mouse click position
  • macOS: option mouse click position

2. Insert an additional cursor above or below

The second way to insert a cursor is to insert it above or below the current cursor position.

  • Windows/Linux : ctrl alt ↓ or ↑
  • macOS : command option ↓ or ↑

3. Undo cursor insertion

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.

  • Windows/Linux : ctrl U
  • macOS : command U

4. Select Insert the cursor at the end of the code

Use this shortcut key to insert the cursor at the end of each line of selected code.

  • Windows/Linux : shift alt I
  • macOS : shift option I

6. Quick coding

1. Move lines or blocks of 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.

  • Windows/Linux : alt ↓ or ↑
  • macOS: option ↓ or ↑

2. Copy lines or blocks of code

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.

  • Windows/Linux : shift alt ↓ or ↑
  • macOS : shift option ↓ or ↑

3. Code indentation

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.

  • Windows/Linux : ctrl [or]
  • macOS : command [or]

4. Switch code comments

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.

  • Windows/Linux: ctrl /
  • macOS: command /

Memorize these VSCode shortcuts to improve your development efficiency!

5. Switch code block comments

Different from the above shortcut keys, the following shortcut keys will comment the selected multiple lines of code into a single comment.

  • Windows/Linux : shift alt A
  • macOS : shift option A

Memorize these VSCode shortcuts to improve your development efficiency!

6. Code Format

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:

  • Windows/Linux: ctrl shift F
  • macOS : option shift F

The following shortcut keys can format the selected code:

  • Windows/Linux : ctrl K, then ctr l F
  • macOS : command K, then command F

7. Quickly fix errors

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.

  • Windows/Linux : ctrl .
  • macOS : command .

8. Rename

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.

  • Windows/Linux: F2
  • macOS: F2 fn

9. Delete whitespace

You can use the following shortcut keys to delete extra blank lines:

  • Windows/Linux : ctrl K X
  • macOS : command K
10. Change the programming language

By default, Visual Studio Code detects the programming language of the file being processed. Usually, it's done by checking the file's extension. However, if the file's extension is not supported, the language may not be detected correctly. Therefore, when you need to change the programming language of a file, you can use this shortcut key.

Windows/Linux
    : ctrl K, then press M
  • macOS
  • : command K, then press M
  • 7. Better Coding
1. Go to the definition

Many times, we need to understand the definition of the code we are using. For example, when calling a function and want to know how the function is defined, you can use this shortcut key.

Windows/Linux
    :F12
  • macOS
  • :F12 fn
  • 2. View definition
This shortcut key can open the definition where the definition is checked. This makes it easier to view definitions without having to switch to another file or line of code.

Windows/Linux
    : alt F12
  • macOS
  • : option F12 fn

3. Switch suggestionsMemorize these VSCode shortcuts to improve your development efficiency!

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/Linux
    : ctrl I
  • macOS
  • : command I
  • VS Code is currently One of the best code editors. It provides many out-of-the-box features and rich third-party extensions. Using shortcut keys in VS Code can make development easier, allowing us to focus on writing high-quality code in less time. This article introduces some practical Visual Studio Code shortcut keys, hoping to help you improve development efficiency!
Finally, here are the shortcut keys for VS Code in Windows, Linux, and macOS systems:

Memorize these VSCode shortcuts to improve your development efficiency!

Memorize these VSCode shortcuts to improve your development efficiency!

For more knowledge about VSCode, please visit: 1Memorize these VSCode shortcuts to improve your development efficiency!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!

Statement
This article is reproduced at:掘金社区. If there is any infringement, please contact admin@php.cn delete
Visual Studio vs. VS Code: Performance and Resource UsageVisual Studio vs. VS Code: Performance and Resource UsageApr 26, 2025 am 12:18 AM

The difference between VisualStudio and VSCode in performance and resource usage is mainly reflected in: 1. Startup speed: VSCode is faster; 2. Memory usage: VSCode is lower; 3. CPU usage: VisualStudio is higher during compilation and debugging. When choosing, it must be determined based on project requirements and development environment.

Visual Studio: The IDE for C#, C  , and MoreVisual Studio: The IDE for C#, C , and MoreApr 25, 2025 am 12:10 AM

VisualStudio (VS) is a powerful integrated development environment (IDE) developed by Microsoft, which supports multiple programming languages, such as C#, C, Python, etc. 1) It provides a rich set of features including code editing, debugging, versioning and testing. 2) VS processes code through powerful editors and debuggers, and supports advanced code analysis and reconstruction using Roslyn and Clang/MSVC compiler platforms. 3) Basic usage is like creating a C# console application, and advanced usage is like implementing polymorphism. 4) Common errors can be debugged by setting breakpoints, viewing output windows, and using instant windows. 5) Performance optimization suggestions include the use of asynchronous programming, code reconstruction and performance analysis.

Visual Studio: Code Compilation, Testing, and DeploymentVisual Studio: Code Compilation, Testing, and DeploymentApr 24, 2025 am 12:05 AM

In VisualStudio, the steps for compiling, testing and deploying the code are as follows: 1. Compiling: Use VisualStudio's compiler options to convert source code into executable files, supporting multiple languages ​​such as C#, C and Python. 2. Testing: Use built-in MSTest and NUnit to perform unit testing to improve code quality and reliability. 3. Deployment: Transfer applications from the development environment to the production environment through web deployment, Azure deployment, etc. to ensure security and performance.

Visual Studio: An Introduction to the Integrated Development Environment (IDE)Visual Studio: An Introduction to the Integrated Development Environment (IDE)Apr 23, 2025 am 12:02 AM

VisualStudioisMicrosoft'sflagshipIDE,supportingmultipleprogramminglanguagesandenhancingcodingefficiency.1)ItoffersfeatureslikeIntelliSenseforcodeprediction,multi-tabbedinterfaceforprojectmanagement,andtoolsfordebugging,refactoring,andversioncontrol.2

Visual Studio: Exploring the Free and Paid OfferingsVisual Studio: Exploring the Free and Paid OfferingsApr 22, 2025 am 12:09 AM

The main difference between the free and paid versions of VisualStudio is the richness of features and the service supported. The free version (Community) is suitable for individual developers and small teams, providing basic development tools; the paid version (Professional and Enterprise) provides advanced features such as advanced debugging and team collaboration tools, suitable for large projects and enterprise-level development.

Visual Studio Community Edition: The Free Option ExplainedVisual Studio Community Edition: The Free Option ExplainedApr 21, 2025 am 12:09 AM

VisualStudioCommunityEdition is a free IDE suitable for individual developers, small teams and educational institutions. 1) It provides functions such as code editing, debugging, testing and version control. 2) Based on the Roslyn compiler platform, it supports multiple programming languages ​​and integrates Git and TFVC. 3) Advanced features include unit testing, optimization suggestions include turning off unnecessary extensions and using a lightweight editor.

Visual Studio: Building Applications with EaseVisual Studio: Building Applications with EaseApr 20, 2025 am 12:09 AM

VisualStudio is an integrated development environment (IDE) developed by Microsoft, which supports a variety of programming languages, including C#, C, Python, etc. 1. It provides IntelliSense function to help write code quickly. 2. The debugger allows setting breakpoints, step-by-step code execution, and identifying problems. 3. For beginners, creating a simple console application is a great way to get started. 4. Advanced usage includes the application of design patterns such as project management and dependency injection. 5. Common errors can be solved step by step through debugging tools. 6. Performance optimization and best practices include code optimization, version control, code quality inspection and automated testing.

Visual Studio and VS Code: Understanding Their Key DifferencesVisual Studio and VS Code: Understanding Their Key DifferencesApr 19, 2025 am 12:16 AM

VisualStudio is suitable for large-scale projects and enterprise-level application development, while VSCode is suitable for rapid development and multilingual support. 1. VisualStudio provides a comprehensive IDE environment and supports Microsoft technology stack. 2.VSCode is a lightweight editor that emphasizes flexibility and scalability, and supports cross-platform.

See all articles

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

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.