ShareYourGroupShareYourGroupKeyboard Shortcuts

Programs · 55 shortcuts

VS Code keyboard shortcuts

Visual Studio Code is the free code editor that most beginners now start with. It can be driven almost entirely from the keyboard. The first column is for Windows and Linux, the second for the Mac.

The two that unlock everything

Ctrl + Shift + P opens the Command Palette. Type a few letters of what you want, such as "format" or "terminal" or "theme", and every matching command appears, with its own shortcut shown beside it. You never need to remember where something is in the menus.

Ctrl + P opens Quick Open. Type part of a file name and press Enter to open it. In a project of hundreds of files, it is far quicker than the file tree.

The next eight

  1. Ctrl + / turns the current line into a comment, and back.
  2. Alt + Up arrow and Alt + Down arrow move the line up or down.
  3. Shift + Alt + Down arrow copies the line below itself.
  4. Ctrl + D selects the next occurrence of the selected word, for editing several at once.
  5. Ctrl + ` opens the built-in terminal.
  6. Ctrl + B shows or hides the side bar.
  7. Shift + Alt + F formats the whole file.
  8. F2 renames a variable or function everywhere it is used.
WindowsMacWhat it does
Ctrl + Shift + P or F1Cmd + Shift + P or F1Open the Command Palette
Ctrl + PCmd + PQuick Open: go to a file by name
Ctrl + ,Cmd + ,Open Settings
Ctrl + K then Ctrl + SCmd + K then Cmd + SOpen the list of keyboard shortcuts
Ctrl + BCmd + BShow or hide the side bar
Ctrl + `Ctrl + `Show or hide the terminal
Ctrl + Shift + ECmd + Shift + EShow the Explorer (files)
Ctrl + Shift + FCmd + Shift + FSearch across all files
Ctrl + Shift + XCmd + Shift + XShow Extensions
Ctrl + Shift + GCtrl + Shift + GShow Source Control
WindowsMacWhat it does
Ctrl + NCmd + NNew file
Ctrl + OCmd + OOpen a file
Ctrl + SCmd + SSave
Ctrl + Shift + SCmd + Shift + SSave As
Ctrl + WCmd + WClose the editor tab
Ctrl + Shift + TCmd + Shift + TReopen the closed editor
Ctrl + TabCtrl + TabSwitch between open files
Ctrl + \Cmd + \Split the editor in two
Ctrl + 1, 2, 3Cmd + 1, 2, 3Move to the first, second or third editor group
WindowsMacWhat it does
Ctrl + XCmd + XCut the whole line, when nothing is selected
Ctrl + CCmd + CCopy the whole line, when nothing is selected
Alt + Up arrow or Alt + Down arrowOption + Up arrow or Option + Down arrowMove the line up or down
Shift + Alt + Up arrow or Shift + Alt + Down arrowShift + Option + Up arrow or Shift + Option + Down arrowCopy the line up or down
Ctrl + Shift + KCmd + Shift + KDelete the line
Ctrl + EnterCmd + EnterInsert a line below
Ctrl + Shift + EnterCmd + Shift + EnterInsert a line above
Ctrl + /Cmd + /Comment or uncomment the line
Shift + Alt + AShift + Option + AComment or uncomment a block
Ctrl + ]Cmd + ]Indent the line
Ctrl + [Cmd + [Outdent the line
Shift + Alt + FShift + Option + FFormat the document
Alt + ZOption + ZWord wrap on or off
WindowsMacWhat it does
Ctrl + DCmd + DAdd the next occurrence of the selection
Ctrl + Shift + LCmd + Shift + LSelect every occurrence of the selection
Alt + clickOption + clickAdd a cursor where you click
Ctrl + Alt + Up arrow or Ctrl + Alt + Down arrowCmd + Option + Up arrow or Cmd + Option + Down arrowAdd a cursor on the line above or below
Ctrl + LCmd + LSelect the current line
Shift + Alt + Right arrowCtrl + Shift + Cmd + Right arrowExpand the selection
EscEscGo back to a single cursor
WindowsMacWhat it does
Ctrl + FCmd + FFind in the file
Ctrl + HCmd + Option + FReplace in the file
Ctrl + GCtrl + GGo to a line number
Ctrl + Shift + OCmd + Shift + OGo to a symbol in the file
F12F12Go to the definition
Alt + Left arrowCtrl + -Go back to where you were
F2F2Rename a symbol everywhere
Ctrl + SpaceCtrl + SpaceShow suggestions
Ctrl + .Cmd + .Show quick fixes
F8F8Go to the next problem
WindowsMacWhat it does
F5F5Start or continue debugging
Ctrl + F5Ctrl + F5Run without debugging
Shift + F5Shift + F5Stop
F9F9Add or remove a breakpoint
F10F10Step over
F11F11Step into

Editing several places at once

Multiple cursors are the feature that most changes how fast you edit. Put the cursor on a word and press Ctrl + D. The word is selected. Press Ctrl + D again and the next occurrence is selected too. Type, and both change together. It is a quick, visible way to rename something in a small area, and safer than find and replace because you see each one being added.

Line shortcuts need no selection

Ctrl + X, Ctrl + C and the Alt + arrow keys act on the whole line when nothing is selected. To move three lines, select any part of all three and press Alt + Up arrow.

Shortcuts can be changed, and extensions add more

Ctrl + K followed by Ctrl + S opens a searchable list of every shortcut, where any of them can be changed. Extensions add their own. If a shortcut here does something else on your computer, look it up in that list. People who come from another editor can install a keymap extension that brings its shortcuts along.

A printable sheet from the makers

In VS Code, Help, Keyboard Shortcuts Reference opens the official one-page sheet for your operating system.

This is an independent reference site. It is not connected with Microsoft, Apple, Google or any other maker of the programs named here. Product names belong to their owners and are used only to say where a shortcut works. Programs change; if a shortcut does not work for you, check the program's own help.