10 VS Code Keyboard Shortcuts That Will Boost Your Productivity

10 VS Code Keyboard Shortcuts That Will Boost Your Productivity

Command Palette

VS Code is equally accessible from the keyboard. The most important key combination to know is Ctrl+Shift+P, which brings up the Command Palette. From here, you have access to all of the functionality of VS Code, including keyboard shortcuts for the most common operations.

  • Windows: CTRL+SHIFT+P
  • Mac: CMD+SHIFT+P

1_m3d4062wn-VRTJd_B-d07A.gif The Command Palette provides access to many commands. You can execute editor commands, open files, search for symbols, and see a quick outline of a file, all using the same interactive window. Here are a few tips:

  • Ctrl+P will let you navigate to any file or symbol by typing its name
  • Ctrl+Tab will cycle you through the last set of files opened
  • Ctrl+Shift+P will bring you directly to the editor commands
  • Ctrl+Shift+O will let you navigate to a specific symbol in a file
  • Ctrl+G will let you navigate to a specific line in a file

Type ? into the input field to get a list of available commands you can execute.

Select the next occurrences of the current selection

  • Windows: CTRL+D
  • Mac: CMD+D

Select all occurrences of the current selection

zpjucdujh9kf2ppj3voo.gif

  • Windows: CTRL+SHIFT+L
  • Mac: CMD+SHIFT+L

Toggle Sidebar

toggle-on--v2.gif

  • Windows: CTRL+B
  • Mac: CMD+B

Copy the entire line

200 (4).webp

  • Windows: SHIFT+ALT+UP or SHIFT+ALT+DOWN
  • Mac: OPT+SHIFT+UP or OPT+SHIFT+DOWN

Join Line

1_UyDM7R7QbTWMiUdWIERoqw.gif

  • Mac: Ctrl+J
  • Ubuntu, Windows: Open keyboard shortcuts from File > Preferences > Keyboard shortcuts, and bind editor.action.joinLines to a shortcut of your choice.

Global Find

  • Windows: CTRL+SHIFT+F
  • Mac: CMD+SHIFT+F

Code Formatting

This shortcut helps to indent the code as already set up in the editor settings.

1_e5rQrZB8WB5g9zzh_MNllw.gif

Tip: Use this in the end or the start. I prefer using it when I’m done with the code in a file.

  • Windows: Shift + Alt + F
  • Mac: Shift + Option + F
  • Ubuntu: Ctrl + Shift + I

Undo

200 (5).webp

  • Windows: CTRL + Z
  • Mac: CMD + Z

Copy Line Up/Down

1_5bE3zR9nHfisxDVcVLab3A.gif

  • Windows: Shift + Alt + Up/Down
  • Mac: Shift + Option + Up/Down
  • Ubuntu: Ctrl + Shift + Alt + Up/Down

Also, you can see the associated keybindings by picking: File > Preferences > Keyboard Shortcuts and editing the binding as per your choice.

Hoping I was able to add some value. Make sure to follow me and share the article to your friends who might like it :)

Visit my Blog for more articles like this.

Quote of the Day ~

You never know how strong you are until being strong is your only choice.

fin