DEV Community

Cover image for Must-Know VS Code Hacks, Shortcuts, and Extensions for Beginners
keshav Sandhu
keshav Sandhu

Posted on • Edited on

Must-Know VS Code Hacks, Shortcuts, and Extensions for Beginners

Visual Studio Code (VS Code) is an incredibly powerful and versatile code editor, and there are a number of tips, shortcuts, and extensions that can significantly improve your workflow—especially if you're a beginner. In this blog post, we'll cover some essential shortcuts, features, and extensions that you need to know to level up your coding experience in VS Code.

1. Reloading the Application without Closing It

Running into performance issues, or just made a configuration change and want to restart VS Code? Instead of fully closing and reopening VS Code, you can reload the window quickly by pressing:

ctrl + shift + p
Enter fullscreen mode Exit fullscreen mode

then select "developer: reload window" option.

This is a handy trick when you're tweaking settings or extensions and need a quick restart without losing your active windows and files.


2. Navigate Quickly with Ctrl/Cmd + P

The Ctrl + P (or Cmd + P on macOS) shortcut is your gateway to speed in VS Code. It's not just for opening files; it’s a super search bar that can help you navigate almost any part of your project:

  • Open a File: Simply start typing a file name, and VS Code will auto-suggest matching files. It's a much faster alternative to browsing through your file tree.

  • Go to a Specific Line: Type : followed by the line number you want to jump to, for example, :45 will jump to line 45.
    You can use Ctrl + G directly too

  • Go to a Symbol: Type @ and search for symbols (functions, variables, classes) within the file.

This single command can save a huge amount of time and reduce friction when navigating between different sections of your code.


3. Use Ctrl/Cmd + Shift + P for Command Palette

If you want to access any VS Code feature or command but can't remember the shortcut, simply hit Ctrl + Shift + P (or Cmd + Shift + P on macOS) to open the Command Palette. You can type the command you need, like:

  • Opening settings
  • Formatting the document
  • Installing extensions
  • Toggling features like the terminal or sidebar

The Command Palette is the Swiss Army knife of VS Code. Once you get used to it, you’ll rarely need to navigate through the menus.


4. Codeium: Free AI Coding Assistant

For those looking to integrate AI into their coding workflow, Codeium is an excellent free AI-powered tool that autocompletes code, generates snippets, and even helps with debugging. It's particularly useful for beginners to quickly understand the structure of common patterns and functions.

  • Installation: You can easily find and install the Codeium extension from the VS Code marketplace.
  • Usage: Once installed, Codeium works in the background to provide AI-driven autocompletions and suggestions.

This tool is a great alternative to paid AI tools like GitHub Copilot, offering many of the same powerful features for free.


5. Git Auto Config for Multiple Accounts

Managing multiple Git accounts (e.g., for work and personal use) in the same environment can be tricky. VS Code simplifies this with its built-in Git support.

Here's how to configure multiple Git accounts easily:

  1. Open your terminal in VS Code.
  2. Set up local configuration for each project like this:
   git config user.name "Your Name"
   git config user.email "your.email@domain.com"
Enter fullscreen mode Exit fullscreen mode

This way, you can ensure that different projects use the correct credentials without having to switch global Git settings each time. For advanced usage, you can even set up SSH keys for different accounts.


6. Integrated Terminal Shortcuts

VS Code's integrated terminal is a powerful feature, but using it efficiently can save you a ton of time. Here are a few essential shortcuts to know:

  • Toggle Terminal: Ctrl + (backtick) instantly opens or hides the integrated terminal.
  • Split Terminal: Ctrl + Shift + 5 to open multiple terminals in one window, useful when you need multiple command-line tools running side by side.
  • Switch Terminals: Ctrl + PgUp or Ctrl + PgDn allows you to easily switch between multiple open terminals.

These shortcuts make switching between code and terminal tasks seamless and reduce the need for external terminal windows.


7. Multiple Cursors for Faster Edits

One of the most powerful and lesser-known features of VS Code is its support for multiple cursors. This feature allows you to edit multiple lines simultaneously:

  • Add Cursors: Alt + Click allows you to place multiple cursors anywhere in the document.
  • Select Next Match: Ctrl + D (or Cmd + D on macOS) selects the next instance of the word under your cursor and adds a cursor to it.
  • Add Cursors to End of Lines: Ctrl + Alt + Down Arrow places cursors on the next line, enabling you to write or edit code on multiple lines simultaneously.

Multiple cursors are especially useful when you need to edit repetitive lines of code, change variables names in bulk, or insert text across different lines.


8. Zen Mode for Distraction-Free Coding

Need to focus? Hit Ctrl + K Z to enter Zen Mode, which hides all distractions like sidebars, the terminal, and other UI elements. This gives you a full-screen, immersive coding experience. Perfect for when you need to concentrate on coding without any distractions.


Conclusion

Whether you're just starting out with VS Code or looking to improve your workflow, these shortcuts, features, and extensions are essential to streamline your coding experience:

  • Reload without closing using code -r ..
  • Navigate quickly with Ctrl/Cmd + P.
  • Use the Command Palette (Ctrl + Shift + P) to access any command.
  • Install Codeium for AI-powered code suggestions.
  • Configure multiple Git accounts easily within VS Code.
  • Maximize productivity with integrated terminal shortcuts and multiple cursors.
  • Try out Zen Mode for focused coding sessions.

VS Code is already an incredibly powerful tool, but by mastering these shortcuts and adding a few essential extensions, you’ll be able to code faster, smarter, and more efficiently. Happy coding!


#VSCode #Programming #DeveloperTips #Shortcuts #AI #CodingWorkflow

Top comments (2)

Collapse
 
seanbracksdev profile image
SeanBracksDev

CTRL + G let’s you enter a line number, no need to use CTRL + P and manually enter :

Collapse
 
keshav___dev profile image
keshav Sandhu • Edited

updated, thanks✨

these are particular keys, if one doesn't remember you can always use ctrl + P and use any of ':', '>'