The Best Shortcuts To Learn for VS Code

May 1, 2020

If you are using VS Code, here are some of the best shortcuts to speed up your coding

Basic Shortcuts

Here’s a quick refresher of some basic hotkeys that are not VS Code specific, but are still useful.

Typing Shortcuts

Shortcut Windows Mac
Copy Ctrl + C cmd + C
Cut Ctrl + X cmd + X
Paste Ctrl + V cmd + V
Save Ctrl + S cmd + S
Undo Ctrl + Z cmd + Z
Redo Ctrl + Y cmd + Y
Find Ctrl + F cmd + F

Opening the Editor

The first shortcut is to open VS Code using your terminal. Find your project folder and enter

>> code .

Line Shortcuts

Shortcut Windows Mac
Toggle Comments Ctrl + / cmd + /
Shifting Lines Alt + ↑ / ↓ option + ↑ / ↓
Duplicate Lines Shift + Alt + ↑ / ↓ shift + option + ↑ / ↓
Format Code Shift + Alt + F shift + option + F

Toggle Comments

This shortcut works regardless of language, and will comment or uncomment any text in your code editor. Toggle comments with Ctrl + / on Windows and cmd + / on Mac.

Shifting Lines

This shortcut allows you to shift a line of code up or down the page without using cut and paste. It is most useful when you have your line written already, and need to adjust its place.

This shortcut can also be done with numerous adjacent lines by selecting them all first. Shift lines or chunks of code with Alt + ↑ / ↓ on Windows and option + ↑ / ↓ on Mac

Duplicating Lines

This shortcut is a powerhouse in VS Code development. First select a line you wish to duplicate, then hold alt and shift. Now, press up or down to duplicate this line above or below your current line.

Format Code

This command will automatically format your code based on whatever formatting rules are in your configuration. Format code with Shift + Alt + F on Windows and shift + option + F on Mac.

Multiple Cursors

There are a few ways to select multiple cursors in VS Code. When you have more than one cursor selected, your typing will occur in multiple places in the file.

Shortcut Windows Mac
Additional Cursor Ctrl + Alt + ↑ / ↓ option + cmd + ↑ / ↓
Select Multiples Ctrl + D option + D
Select All of a word Ctrl + Shift + L cmd + shift + L

Create New Cursor

If you want to create a new cursor use Alt + left-click on Windows or option + left-click on Mac. Alternatively and keyboard only, you can use Ctrl + Alt + ↑ / ↓ on Windows or option + cmd + ↑ / ↓ on Mac.

Select Multiples

If you have multiple words or strings use Ctrl + D on Windows or option + D on Mac to select the next instance of a given word or string.

Select all instances of a word

You can select all instances of a word in a file by holding this down or instead using Ctrl + Shift + L on Windows or cmd + shift + L on Mac.

Copy/Paste for multiple lines

You can cut/copy multiple lines in VS Code. As long as your cursors are still active you can also paste on all cursors.

Search Shortcuts

VS Code has gotten so much traction as a result of its excellent developer experience. Here are some powerful search features you can use in the editor

Shortcut Windows Mac
Command Palette Ctrl + / Cmd + /
Search All Files Ctrl + Shift + F cmd + shift + F
Split Editor Ctrl + \ cmd + \
Open Terminal Ctrl + Shift + ` ctrl + `

Command Palette

You can access this with Ctrl + Shift + P on Windows and Cmd + Shift + P on Mac. This is a search feature that can be used to find and open files.

Search all files

With this command you can search through every file in your project for a phrase. This is extremely helpful if you know what you’re looking for but forget where its located. This hotkey is Ctrl + Shift + F on Windows and cmd + shift + F on Mac

Split Editor

This command will quickly open a second code editor in your VS code instance. Create this second editor using Ctrl + \ on Windows or cmd + \ on Mac.

Open Integrated Terminal

You can quickly open a new terminal in your project with Ctrl + Shift + ` on Windows and ctrl + ` on Mac.

Mac only Hotkeys

Here are 2 hotkeys that I still haven’t managed to use on Windows.

Navigate Line / Document

Using cmd + ← / → you can navigate to the beginning or end of a line on Mac. You can also navigate to the beginning or end of the document using cmd + ↑ / ↓.

Select Entire Line

When at the end of line on Mac use command + shift + ← or at the beginning use command + shift + → to select an entire line. This hotkey can be used in combination with the previous one when in the middle of a line. Once selected, you can combo this hotkey with the Duplicating code hotkey or cmd + shift + ↑ / ↓.


These are some of the basic hotkeys for VS Code. It is helpful to learn a few at a time and practice them often to build speed. There are plenty more VS Code hotkeys for both Windows and Mac.

Other Tools Tutorials


Top 5 Ways to Setup a React Application


Hosting Web Apps with Heroku