15 VS Code Keyboard Shortcuts to Boost your Coding Efficiency

Rakesh Kumar R
4 min readJun 10, 2024

--

Visual Studio Code Editor

Visual Studio Code (VS Code) is a powerful and versatile code editor that offers numerous features to enhance your productivity. Mastering keyboard shortcuts can save you a lot of time and make your coding experience smoother. Here are fifteen essential shortcuts to help you boost your coding efficiency in VS Code.

1. Command Palette:

Ctrl + Shift + P  -  Windows 
Cmd + Shift + P - Mac

The Command Palette is the gateway to all of VS Code’s functionality. By pressing Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (Mac), you can quickly access commands, settings, and extensions without navigating through menus.

How to Use:

- Press the shortcut to open the Command Palette.

- Start typing the command you need.

- Select the command from the list.

2. Quick Open:

Ctrl + P - Windows 
Cmd + P - Mac

Quick Open allows you to open any file in your workspace instantly. This is especially useful when working on large projects with many files.

How to Use:

- Press Ctrl + P (Windows/Linux) or Cmd + P (Mac).

- Start typing the file name.

- Select the file from the list.

3. Multi-Cursor Editing:

Alt + Click - Windows 
Option + Click - Mac

Multi-cursor editing lets you place multiple cursors in your code, allowing you to make changes in several places at once.

How to Use:

- Hold Alt (Windows/Linux) or Option (Mac) and click where you want to add additional cursors.

- Start typing to edit multiple lines simultaneously.

4. Go to Definition:

F12

This shortcut takes you directly to the definition of a function, variable, or class, saving you the hassle of manually searching through files.

How to Use:

- Place the cursor on the function, variable, or class name.

- Press F12 to jump to its definition.

5. Rename Symbol:

F2

Easily rename all instances of a variable, function, or class in your project with the Rename Symbol shortcut.

How to Use:

- Place the cursor on the symbol you want to rename.

- Press F2, type the new name, and press Enter.

6. Split Editor:

Ctrl + \  - Windows 
Cmd + \ - Mac

Split Editor allows you to view and edit multiple files side by side. This is useful for comparing code or working on different parts of your project simultaneously.

How to Use:

- Press Ctrl + \ (Windows/Linux) or Cmd + \ (Mac) to split the current editor into two.

- Open a different file in the new editor pane.

7. Move Line Up/Down:

Alt + ↑ / ↓  - Windows 
Option + ↑ / ↓ - Mac

Rearrange your code quickly by moving lines up or down without the need for cutting and pasting.

How to Use:

- Place the cursor on the line you want to move.

- Press Alt + ↑ / ↓ (Windows/Linux) or Option + ↑ / ↓ (Mac) to move the line up or down.

8. Format Document:

Shift + Alt + F - Windows 
Shift + Option + F - Mac

Keep your code clean and well-formatted with the Format Document shortcut. This automatically formats your code according to the language-specific style guide.

How to Use:

- Press Shift + Alt + F (Windows/Linux) or Shift + Option + F (Mac) to format the entire document.

9. Comment/Uncomment Line:

Ctrl + /  - Windows 
Cmd + / - Mac

Quickly comment or uncomment a line or selected block of code.

How to Use:

- Place the cursor on the line or select the block of code.

- Press Ctrl + / (Windows/Linux) or Cmd + / (Mac).

10. Duplicate Line:

Shift + Alt + ↓  - Windows 
Shift + Option + ↓ - Mac

Duplicate the current line or selected block of code.

How to Use:

- Place the cursor on the line or select the block of code.

- Press Shift + Alt + ↓ (Windows/Linux) or Shift + Option + ↓ (Mac).

11. Delete Line:

Ctrl + Shift + K  - Windows 
Cmd + Shift + K - Mac

Delete the current line without having to select it.

How to Use:

- Place the cursor on the line you want to delete.

- Press Ctrl + Shift + K (Windows/Linux) or Cmd + Shift + K (Mac).

12. Navigate Between Open Files:

Ctrl + Tab

Quickly switch between open files using this shortcut.

How to Use:

- Press Ctrl + Tab to cycle through open files.

13. Go to Line:

Ctrl + G - Windows 
Cmd + G - Mac

Jump to a specific line number in your current file.

How to Use:

- Press Ctrl + G (Windows/Linux) or Cmd + G (Mac).

- Enter the line number and press Enter.

14. Select All Occurrences:

Ctrl + Shift + L  - Windows 
Cmd + Shift + L - Mac

Select all occurrences of the current word or selection in the document.

How to Use:

- Place the cursor on the word or select the text.

- Press Ctrl + Shift + L (Windows/Linux) or Cmd + Shift + L (Mac).

15. Open Settings:

Ctrl + ,  - Windows 
Cmd + , - Mac

Quickly open the settings window to adjust your VS Code preferences.

How to Use:

- Press Ctrl + , (Windows/Linux) or Cmd + , (Mac).

Conclusion

Learning these VS Code shortcuts will significantly enhance your coding efficiency and streamline your workflow. By incorporating these shortcuts into your daily routine, you’ll save time and reduce the friction of navigating through menus and performing repetitive tasks.

Start using these shortcuts today, and you’ll soon notice a boost in your productivity and coding enjoyment. Happy coding!

--

--

Rakesh Kumar R
Rakesh Kumar R

Written by Rakesh Kumar R

0 Followers

Developer and Designer

No responses yet