13 useful VSCode shortcuts for faster development

As a developer, I’ve already used many different text editors such as Atom, Sublime Text, and Notepad++. But in Visual Studio Code (VSCode) I see a powerful tool for making websites.

Frequently, I’m asked by my team about certain shortcuts in VSCode. In this blog post, I’m going to share some of the most useful shortcuts that I use.

Format code

This shortcut helps to put your code in the correct format. Of course, you first need to edit your formatting settings in the editor. To apply the shortcut, you have to press:

  • On Windows: Shift + Alt + F
  • On Mac: ⇧ + ⌥ + F
  • On Linux: Ctrl + Shift + I

Show command palette

This is one of the most useful commands that I know. With this command, you can run an extension or figure out its shortcuts.

  • On Windows: Ctrl + Alt + P
  • On Mac: ⇧ + ⌘ + P
  • On Linux: Ctrl + Shift + P

Move line up/down

In order to move a line up or down, use the following shortcut:

  • On Windows: Alt + Up/Down
  • On Mac: ⌥ + Up/Down
  • On Linux: Alt + Up/Down

Duplicate cursor

This shortcut helps you a lot when you need to type in different lines.

  • On Windows: Ctrl + Alt + Up/Down
  • On Mac: Command + Alt + Up/Down
  • On Linux: Ctrl + Alt + Up/Down

Also, if you keep pressed Ctrl + Alt and click with your mouse in any line, you’ll duplicate the cursor several times in the respective lines.

Select word

With this shortcut, you can select the word under your cursor.

  • On Windows: Ctrl+ D
  • On Mac: ⌘ + D
  • On Linux: Ctrl + D

If you press Ctrl + D more than once, you’ll add another occurrence of the same keyword to your selection.

Open and close the sidebar

This shortcut allows you to open and close the sidebar immediately.

  • On Windows: Ctrl+ B
  • On Mac: ⌘ + B
  • On Linux: Ctrl + B

In some situations, this will help you a lot - especially when you have a very long code snippet.

Go to a specific line

With this shortcut, you can go to a specific line in the file that you have opened.

  • On Windows: Ctrl + G
  • On Mac: ⌃ + G
  • On Linux: Ctrl + G

Remove a line

This is how to remove the full line under your cursor:

  • On Windows: Ctrl + X
  • On Mac: ⌘ + X
  • On Linux: Ctrl + X

Open new terminal

VSCode has the possibility of an internal terminal. This means that you can run shell commands without losing your focus in the editor.

  • On Windows: Ctrl + Shift + `
  • On Mac: ⌃ + Shift + `
  • On Linux: Ctrl + Shift + `

Show/hide terminal

This shortcut allows you to show and hide the VSCode’s terminal without losing your entries.

  • On Windows: Ctrl + `
  • On Mac: ⌃ + `
  • On Linux: Ctrl + `

Go to file

With this shortcut, you can go to a specific file in your project.

  • On Windows: Ctrl + P
  • On Mac: ⌘ + P
  • On Linux: Ctrl + P

Open Settings

If you’d like to change your VSCode settings, you can go with this shortcut.

  • On Windows: Ctrl + ,
  • On Mac: ⌘ + ,
  • On Linux: Ctrl + ,

Select current line

You can select the full line under your cursor.

  • On Windows: Ctrl + L
  • On Mac: ⌘ + L
  • On Linux: Ctrl + L

Overview of all available shortcuts

There are more shortcuts available, and maybe some of the ones above are different in your Linux distribution (I use Ubuntu). But don’t worry, you can check all of them and even customize them. You only need to go to File -> Preferences -> Keyboard Shortcuts.

On the website of VSCode, you can find a PDF with all available shortcuts for your operating system:

About the author

German San Emeterio is a JavaScript Developer who is now into Ruby on Rails. He is fond of video games, and mangas, as well as loves to learn new technologies.