5 VS Code Shortcuts To Up Your Productivity
Tags: vscode, productivity, codebase, shortcuts
Published: 2023-02-23 13:31:33

Working in a moderate-sized to large codebase usually involves having to trace through many source files to see how different components interact with one another, especially when you're new to the project or starting a new ticket that involves code blocks you are not familiar with.

So these shortcuts in VS Code can help you find your way quickly in the codebase faster and more efficiently.

### 1️⃣ Search for Files: Ctrl + P (Windows/Linux), Command + P (Mac)

This helps you quickly search for and open files in your workspace. It does this by providing a drop-down of suggestions which changes accordingly as you type in the name of the file you're searching.

![Ctrl + P Shortcut in VS Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6s7weuqfzvo9b1snw2p.gif)

### 2️⃣ Find and Replace: Ctrl + F (Windows/Linux), Command + F (Mac)

This allows you to find and replace text in the current file. It is done by an overlying input bar that takes in your entries and matches them simultaneously with corresponding lines of code in the file. Matching lines of text get highlighted and you can also move up or down lines of code that match thanks to the up and down arrows next to the input.

![Ctrl + F Shortcut in VS Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68u3subfngyv21bqs3nw.gif)

### 3️⃣ Move Line Up/Down: Alt + Up/Down Arrow (Windows/Linux/Mac)

This one allows you to quickly move a line of code up or down in the file. This happens by having the cursor on the line you intend to move and then you apply the Alt + Up/Down Arrow.

![Alt + Up/Down Arrow Shortcut in VS Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aoayegt3f5sy0x3n13gb.gif)

### 4️⃣ Multi-Cursor Editing: Alt + Click (Windows/Linux/Mac)

Have you ever had to rename multiple instances of an identifier in a file? Well, this shortcut adds multiple cursors to your code, which makes such multi-line changes possible. You can also select instances of a variable or function name (or just about any line of text) by highlighting it and then doing Ctrl + D on Windows/Linux or Shift + Cmd + L on Mac.

![Alt + Click Shortcut in VS Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ad6f2nzlrbh2pad4vrzk.gif)

### 5️⃣ Switch between Open Files: Ctrl + Tab (Windows/Linux), Command + Tab (Mac)

This allows you to switch between open files in your workspace. It toggles between the current file and the one you visited last. But you could also go to other files with Ctrl + Shift + Tab (Windows/Linux) or Cmd + Shift + Tab (Mac).

![Ctrl + Tab Shortcut in VS Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ahrpwiqu71yasj874tnt.gif)

### Wrapping Up

Ctrl + Tab, Ctrl + F and Ctrl + P (on Windows) are the three shortcuts I use most because I often have to search for identifiers and blocks of code among files, followed by Alt + Up/Down. Multi-cursor editing comes once in a blue moon and I also tend to just forget about it.

There are more VS Code shortcuts but I tend to use these because they come in handy and don't need many keystrokes.