Search anything:

25 tricks and shortcuts of VSCode

Binary Tree book by OpenGenus

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

Before delving into the Infinity Trick of VS Code, it is recommended to get familiar with this popular code editor used widely by developers. VS Code is considered an Integrated Development Environment (IDE) equipped with a plethora of features like plugins, extensions, version control integration, and particularly, shortcuts to speed up code writing. Using these shortcuts not only makes your work easier but also adds a cool factor when observed by others who might be still performing the same tasks manually.

Here are 25 tricks that can help you improve your productivity when using VS Code:

Splitting the Editor: You can split the editor into multiple panes by pressing "Ctrl + " or "Cmd + ". This allows you to view and edit multiple files at the same time.

Multi-Cursor Editing: You can add multiple cursors to edit multiple lines at once by holding down "Alt" and clicking on the lines you want to edit. This is useful for making changes to similar lines of code.

  • Command Palette: You can access all of VS Code's commands by pressing "Ctrl + Shift + P" or "Cmd + Shift + P". This allows you to quickly search for and execute commands without having to remember keyboard shortcuts.

  • Emmet: VS Code has built-in support for Emmet, a tool that allows you to write HTML and CSS code faster. You can use Emmet by typing a CSS selector and pressing "Tab" to expand it into HTML code.

  • Snippets: You can create your own code snippets to save time when writing code. To create a snippet, go to "File -> Preferences -> User Snippets" and select the language for which you want to create a snippet.

  • Git Integration: VS Code has built-in support for Git, allowing you to easily manage your Git repositories without leaving the editor. You can view changes, commit code, and push and pull changes directly from VS Code.

  • Extensions: VS Code has a large library of extensions that can help you with tasks such as debugging, linting, and code formatting. You can browse and install extensions from the VS Code Marketplace.

  • Open New Window: This shortcut opens a new instance of Visual Studio Code.key is Ctrl + Shift + N

  • Close Window: This shortcut closes the current instance of Visual Studio Code.Ctrl + Shift+W

  • Quick Open File: this shortcut is use for Quick Open File.this allows you to quickly search for and open files in your project.Ctrl + P

  • Search in Files: this shortcut is use for Search in file.this will help you to find and makes changes in file.Ctrl + Shift + F

  • Delete Line: this shortcut is use for Delete line.This shortcut deletes the current line in the file.Ctrl + Shift + k

  • To Find in file: this shortcut is use for find anything in code.This help you to find anything in current in the file.Ctrl + F

  • Move Line Up/Down: this shortcut moves the current line up or down in the file.Alt + Up/Down

  • Select All Occurrences of Current Selection: This shortcut selects all similer words of the selected text in the current file.Ctrl + Shift + L

  • Replace in Files: This shortcut opens the replace box to replace text in all files in your project.Ctrl + Shift + H

  • Move Line Up/Down: This shortcut moves the current line up or down in the file..Alt + Up/Down

  • Toggle Block Comment: This shortcut toggles the comment status of the selected block of text.Ctrl + Shift + /

Zoom In/Out: When you want to zoom in or out in the editor, you can use the keyboard shortcuts Ctrl + = or Cmd + = to zoom in and Ctrl + - or Cmd + - to zoom out. This is particularly useful when you need to focus on a specific part of your code or want to see your code more clearly.

Format Document: Pressing Shift + Alt + F will format the entire document according to your code style guide. This will ensure that your code is consistent and easy to read, making it easier for you to maintain and collaborate with others.

Go to Line: Pressing Ctrl + G allows you to quickly navigate to a specific line number in the current file. This is particularly useful when working with longer files where it can be difficult to find the exact line you're looking for.

Toggle Sidebar: Pressing Ctrl + B allows you to toggle the sidebar on and off. The sidebar provides access to your project files, extensions, and other useful tools, and can be hidden when you need more screen space to work.

Open Integrated Terminal: To open the integrated terminal in VS Code, press Ctrl + Shift + `. This allows you to run terminal commands directly from VS Code, without needing to switch to a separate terminal application.

Rename Symbol: Pressing F2 allows you to quickly rename a variable or symbol across your entire project. This can save you a lot of time and effort when you need to rename a commonly used variable or function.

Open Recent Files: Pressing Ctrl + R opens the list of recently opened files in VS Code. This makes it easy to quickly navigate back to a file you were working on earlier, without needing to search for it in your project folder.

Toggle Zen Mode: Pressing Ctrl + K, Z enters Zen mode, which hides all UI elements except for the editor. This provides a distraction-free environment for coding and can help you stay focused and productive.

With this article at OpenGenus, you must be able to use VSCode more efficiently.

Manish Kumar

Manish Kumar

I am first year student at KIIT. I am currently learning Web Development, started writing blogs as to record my learning journey, it gives me deeper understanding when I learn and write it later.

Read More

Improved & Reviewed by:

OpenGenus Tech Review Team OpenGenus Tech Review Team
25 tricks and shortcuts of VSCode
Share this