VSCode Keyboard Shortcuts Cheatsheet

A photograph of a laptop running VSCode.

Visual Studio Code (VSCode) has become one of developers’ and power users’ most popular text editors. It comes packed with features, shortcuts, extensions, and more to cater to every developer’s caliber. However, like most tools, it is only as powerful as the user.

VSCode Keyboard Shortcuts Cheatsheet Download

Download this Cheatsheet

Enter your email below to receive this PDF cheatsheet in your Inbox.

By default, VSCode already provides a set of keyboard shortcuts that can control almost any aspect of the text editor. For example, the program provides a way to toggle its user interface and enable its “rich languages” feature. However, one of the most significant limitations of VSCode is it has no clear way of knowing the available shortcuts inside the program.

Luckily, this VSCode ultimate keyboard shortcuts cheatsheet will provide you with the most common and useful shortcuts to turn you into a Visual Studio Code power user.

WindowsLinuxMacFunction
Managing Files
Ctrl + OCtrl + OCmd + OOpens a file from the file system.
Ctrl + NCtrl + NCmd + NCreates a new file.
Ctrl + SCtrl + SCmd + SSaves the current file.
Ctrl + Shift + SCtrl + Shift + SCmd + Shift + SEnables Save As mode, which allows you to define an extension or rename a file
Ctrl + K, then SCmd + Option + SSave All.
Ctrl + F4Ctrl + WCmd + WClose the current open file, saving the changes.
Ctrl + K, then Ctrl + WCtrl + K, then Ctrl + WCmd + K, then Cmd + WClose all open files simultaneously, saving the changes.
Ctrl + Shift + TCtrl + Shift + TCmd + Shift + TReopen closed editor window.
Ctrl + K, then RCtrl + K, then RCmd + K, then ROpen the file location of the active file in the file system.
Ctrl + K, then PCtrl + K, then PCmd + K, then PCopy the full path of the active file.
Ctrl + Shift + FCtrl + Shift + FCmd + Shift + FShow the search window.
Managing the Editor
Ctrl + Backslash (\)Ctrl + Backslash (\)Cmd + Backslash (\)Split the editor by adding one extra editing window.
Ctrl + WCtrl + WCmd + WClose the current editor window.
Ctrl + K, then FCtrl + K, then FCmd + K, then FClose the currently opened folder and default to the main window.
Alt + ZAlt + ZOption + ZEnable or disable word wrap on the current file.
Ctrl + Shift + UCtrl + K, then Ctrl + HCmd + Shift + UToggle VSCode’s output window.
Ctrl + K, then ZCtrl + K, then ZCmd + K, then ZToggle VSCode’s Zen mode.
Editing Files
Ctrl + CCtrl + CCmd + CCopy the current line if section is highlighted.
Alt + Shift + Up arrowCopy the current line if the section is highlighted.Copy the line above the current line.
Alt + Shift + Down arrowReplace the entity in the current file.Copy the line below the current line.
Ctrl + XCtrl + XCmd + XCut the current line if no section is highlighted.
Ctrl + FCtrl + FCmd + FSearch in the current file.
Ctrl + HCtrl + HCmd + Option + FReplace entity in the current file.
Ctrl + LCtrl + LCmd + LSelect the current line.
Ctrl + Shift + LCtrl + Shift + LCmd + Shift + LSelect all instances of the current line in the file.
F3F3Cmd + GFind next.
Shift + F3Shift + F3Cmd + Shift + GFind previous.
Ctrl + Shift + KCtrl + Shift + KCmd + Shift + KMove the current lineup from the current position.
Ctrl + UCtrl + UCmd + UUndo the most recent cursor operation.
Alt + Up ArrowAlt + Up ArrowOption + Up ArrowMove the current line up from its current position.
Alt + Down ArrowAlt + Down ArrowOption + Down ArrowMove the current line down from the current position.
EndEndEndGo to the end of the current line.
HomeHomeHomeGo to the beginning of the file.
Ctrl + EndCtrl + EndCmd + Down ArrowGo to the end of a file.
Ctrl + HomeCtrl + HomeCmd + Up ArrowGo the beginning of the file.
Alt + EnterAlt + EnterOption + EnterSelect all occurrences of the found matches.
Ctrl + EnterCtrl + EnterCmd + EnterInsert a new line below the current line.
Ctrl + Shift + EnterCtrl + Shift + EnterCmd + Shift + EnterInsert a new line above the current line.
Ctrl + Shift + Backslash (\)Ctrl + Shift + Backslash (\)Cmd + Shift + Backslash (\)Go to the matching bracket.
Ctrl + Right Square Bracket (])Ctrl + Right Square Bracket (])Cmd + Right Square Bracket (])Automatically indent the current line if no section is highlighted.
Ctrl + Left Square Bracket ([)Ctrl + Left Square Bracket ([)Cmd + Left Square Bracket ([)Automatically outdent the current line if no section is highlighted.
Alt + Shift + FCtrl + Shift + IOption + Shift + IFormat the current document.
Ctrl + K, then Ctrl + FCtrl + K, then Ctrl + FCmd + K, then Cmd + FFormat the selected section.
Ctrl + Shift + HCtrl + Shift + HCmd + Shift + HReplace in Files.
Ctrl + Period (.)Ctrl + Period (.)Cmd + Period (.)Show Quick Fix actions, if one is available.
Ctrl + K, then MCtrl + K, then MCmd + K, then MAlter the current file language and set to auto-detect by default.
Ctrl + K, then Ctrl + XCtrl + K, then Ctrl + XCmd + K, then Cmd + XRemove all excess spaces and tabs in the document.
Ctrl + SpaceCtrl + SpaceCtrl + SpaceManually activate a code suggestion.
Alt + Left Mouse ClickAlt + Left Mouse ClickOption + Left Mouse ClickInsert a cursor.
Commenting Code
Ctrl + Slash (/)Ctrl + Slash (/)Cmd + Slash (/)Comment or uncomment out the current line.
Ctrl + K, then Ctrl + CCtrl + K, then Ctrl + CCmd + K, then Cmd + CCreate a comment on the current line.
Ctrl + K, then Ctrl + UCtrl + K, then Ctrl + UCmd + K, then Cmd + URemove a comment on the current line.
Alt + Shift + ACtrl + Shift + AOption + Shift + AComment or uncomment out the currently selection region.
Function Definitions
F12F12F12Open the library definition of the current function.
Ctrl + K, then F12Ctrl + K, then F12Cmd + K, then F12Open a new window containing the library definition of the current function.
Alt + F12Ctrl + Shift + F10Option + F12Open a small window that shows the library definition of the current function.
Shift + F12Shift + F12Shift + F12Find all the functions in the project that references the current function.
F2F2F2Rename the current function.
Ctrl + F2Ctrl + F2Rename the current function and replace all instances of it in the file.
General Usage
Ctrl + Shift + PCtrl + Shift + PCmd + Shift + PLaunch the Command Palette.
Ctrl + Comma (,)Ctrl + Comma (,)Cmd + Comma (,)Open the user settings.
Ctrl + K, then Ctrl + SCtrl + K, then Ctrl + SCmd + K, then Cmd + SLaunch the Keyboard Shortcut interface.
Ctrl + Shift + NCtrl + Shift + NCmd + Shift + NOpen a new window.
Ctrl + Shift + WCtrl + WCmd + WClose the window.
Ctrl + Left Mouse ClickCtrl + Left Mouse ClickOpen the link on the default browser.
Navigating VSCode
Ctrl + TCtrl + TCmd + TQuickly toggle all symbols.
Ctrl + PCtrl + PCmd + PGo to a specific file.
Ctrl + Shift + OCtrl + Shift + OCmd + Shift + ONavigate to a specific symbol.
F11F11Cmd + Ctrl + FEnable full screen mode.
Ctrl + Shift + ECtrl + Shift + ECmd + Shift + EToggle Explorer/Editor Focus.
Ctrl + Shift + XCtrl + Shift + XCmd + Shift + XShow/Search Visual Studio extensions.
Ctrl + Shift + DCtrl + Shift + DCmd + Shift + DShow the Debug panel.
Ctrl + Equal (=)Ctrl + Equal (=)Cmd + Equal (=)Zoom in the VSCode interface.
Ctrl + Minus (-)Ctrl + Minus (-)Cmd + Shift + Minus (-)Zoom out the VSCode interface.
Ctrl + Shift + Left Square Bracket ([)Option + Shift + Left Square Bracket ([)Hide the current region of code.
Ctrl + Shift + Right Square Bracket (])Option + Shift + Right Square Bracket (])Unhide the current region of code.
Ctrl + K, then Ctrl + 0Ctrl + K, then Ctrl + 0Cmd + K, then Cmd + 0Hide all regions in the currently open file.
Ctrl + K, then Ctrl + JCtrl + K, then Ctrl + JCmd + K, then Cmd + JUnhide all regions in the currently open file.
Ctrl + K, then Ctrl + Left Square Bracket ([)Cmd + K, then Cmd + Left Square Bracket ([)Hide all subregions in the currently open file.
Ctrl + K, then Ctrl + Right Square Bracket (])Cmd + K, then Cmd + Right Square Bracket (])Unhide all subregions in the currently open file.
Terminal Mode
Ctrl + Backtick (`)Ctrl + Backtick (`)Ctrl + Backtick (`)Open the terminal.
Ctrl + Shift + Backtick (`)Ctrl + Shift + Backtick (`)Ctrl + Shift + Backtick (`)Create a new terminal instance.
Ctrl + CCtrl + Shift + CCmd + CCopy the highlighted section.
Ctrl + VCtrl + Shift + VPaste into the active terminal session.
Ctrl + Up ArrowCtrl + Shift + Up ArrowCmd + Up ArrowScroll Up in the active terminal.
Ctrl + Shift + Down ArrowCtrl + Shift + Down ArrowCmd + Down ArrowNavigate to the top.
Ctrl + HomeCtrl + HomeCmd + HomeNavigate to the top.
Ctrl + EndCtrl + EndCmd + EndScroll to bottom.
Debug Mode
F9F9F9Create a breakpoint at the currently highlighted line.
F5F5F5Run the code one step after the breakpoint.
F11F11F11Go inside either the child function or loop.
Shift + F11Shift + F11Shift + F11Go outside either the child function or loop.
F10F10F10Skip the execution on the current breakpoint.
F8F8F8Move the pointer to the next error in the file.
Shift + F8Shift + F8Shift + F8Move the point to the previous error in the file.
Shift + F5Shift + F5Shift + F5Stop the debugging session.

Image credit: Unsplash. All alterations by Ramces Red.

Is this post useful?
Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Ramces Red
Ramces Red - Staff Writer

Ramces is a technology writer that lived with computers all his life. A prolific reader and a student of Anthropology, he is an eccentric character that writes articles about Linux and anything *nix.