DEV Community

Cover image for Top 20 VS Code Shortcuts You Should Know
Debarghya Chanda
Debarghya Chanda

Posted on • Edited on

Top 20 VS Code Shortcuts You Should Know

Introduction:

Visual Studio Code (VS Code) is a popular, open-source code editor used by developers worldwide. One of the things that make it stand out is its extensive set of keyboard shortcuts. These shortcuts help developers navigate and work with code more efficiently, ultimately improving productivity. In this blog, we'll share the top 20 VS Code shortcuts that every developer should know.

Shortcuts:

1. Open File:

  • Press Ctrl + O to open a file quickly in VS Code.

2. Switch Between Open Files:

  • Use Ctrl + Tab to switch between open files quickly.

3. Search for Files:

  • Press Ctrl + P to search for files in your workspace.

4. Toggle Terminal:

  • Use Ctrl + ~ to toggle the integrated terminal in VS Code.

5. Split Editor:

  • Press Ctrl + \ to split the editor vertically or horizontally.

6. Move Editor Focus:

  • Use Ctrl + 1, 2, 3... to move the editor focus to the first, second, third, and so on tabs.

7. Comment/Uncomment Code:

  • Press Ctrl + / to comment or uncomment a line or block of code.

8. Go to Definition:

  • Use Ctrl + Click to go to the definition of a variable or function.

9. Find All References:

  • Press Shift + F12 to find all references to a variable or function.

10. Format Document:

  • Use Shift + Alt + F to format the entire document.

11. Rename Symbol:

  • Press F2 to rename a variable, function, or class across the entire workspace.

12. Duplicate Line or Selection:

  • Use Shift + Alt + Up/Down Arrow to duplicate a line or selection.

13. Toggle Word Wrap:

  • Press Alt + Z to toggle word wrap on or off.

14. Select Word:

  • Use Ctrl + D to select the word at the cursor, then press Ctrl + D again to select the next occurrence of the word.

15.Select Line:

  • Press Ctrl + L to select the current line.

16. Move Selected Line(s) Up or Down:

  • Use Alt + Up/Down Arrow to move the selected line(s) up or down.

17. Zoom In/Out:

  • Press Ctrl + + or Ctrl + to zoom in or out on the editor.

18. Toggle Sidebar:

  • Use Ctrl + B to toggle the sidebar in VS Code.

19. Toggle Full-Screen Mode:

  • Press F11 to toggle full-screen mode in VS Code.

20. Find and Replace:

  • Press Ctrl + H to bring up the Find and Replace dialog box, which allows you to search for and replace text across your workspace or in a specific file.

Conclusion:

These are just a few of the many VS Code shortcuts available to developers. Knowing these shortcuts can save time, increase productivity, and help streamline your workflow. We hope that this blog has provided you with some valuable insights and that you'll be able to use these shortcuts to your advantage in your coding endeavours. Happy coding!

Top comments (0)