My 5 favorite keyboard shortcuts in VS Code

My 5 favorite keyboard shortcuts in VS Code

Using keyboard shortcuts to increase efficiency and productivity

·

2 min read

Do you use VS code a lot? Do you wish to decrease your development time? Then you have come to the right place. Here are my five favorite keyboard shortcuts which I use regularly:

  1. Rename symbol

    Windows, Mac: F2

    If you want to rename all references of a symbol (e.g. variable, function etc.) in one go, you can first click on the symbol you want to rename, press F2 and rename it.

  2. Quick open file

    Windows: Ctrl + P, Mac: Cmd + P

    Instead of looking through your sidebar to find the right file, you can use this shortcut to open and type the name of the file to navigate to it. Here is a screenshot of the quick open bar:

  3. Go back

    Windows: Alt + <-, Mac: Ctrl + -

    Go forward

    Windows: Alt + ->, Mac: Ctrl + Shift + -

    Using the above shortcuts, you can easily navigate to the previous or next cursor position. This is especially useful when you are exploring the code and want to go back and forth.

  4. Toggle line comment

    Windows: Ctrl + /, Mac: Cmd + /

    Select the lines that you wish to comment or uncomment and then use this shortcut

  5. Show search

    Windows: Ctrl + Shift + F, Mac: Cmd + Shift + F

    You can use the search functionality to find all occurrences of a specific text across all files in your project. There are several options including match case and regular expressions. Here is a screenshot of the search bar:

Bonus

  • Toggle integrated terminal

    Windows, Mac: Ctrl + ~

    This is useful if you want to toggle the visibility of the integrated terminal. Here is a screenshot:

Important Note

You can even customize these shortcuts using the keyboard shortcuts editor. You can open this editor by going to the menu under File > Preferences > Keyboard Shortcuts (Code > Preferences > Keyboard Shortcuts on macOS)

Thanks for reading the article and I hope you found it useful.