Essential Keyboard Shortcuts for Visual Studio Code

Metaverse News
Laptop displaying text editor

Microsoft Visual Studio Code debuted only a few years ago, but it has quickly become one of the most popular text editors available. Its combination of a simple user interface with powerful IDE-like features makes it especially popular with programmers, but it’s just as useful for writers and anyone who manipulates text files.

Visual Studio Code supports nearly every programming language that exists. If support isn’t built-in, you can add it through the app’s extension browser. VS Code even has native features to support collaborative programming. Plus, it has plenty of keyboard shortcuts to help you navigate the app interface effortlessly.

And what’s more, you can discover the most useful VS Code keyboard shortcuts with this cheat sheet!

Because of the sheer number of users on Windows, that OS is the main focus of this cheat sheet. Don’t worry if you’re a Mac user though, as all of these keyboard shortcuts work on macOS as well. Simply use the Command key instead of the Ctrl key and the Option key instead of Alt. If any shortcuts vary more than that, we’ll mention both.

FREE DOWNLOAD: This cheat sheet is available as a downloadable PDF from our distribution partner, TradePub. You will have to complete a short form to access it for the first time only. Download The Visual Studio Code Keyboard Shortcuts Cheat Sheet.

The Visual Studio Code Keyboard Shortcuts Cheat Sheet

On a Mac keyboard, replace Ctrl with Cmd and Alt with Option in the shortcuts.

Shortcut Action
Basic Functionality
Ctrl + Shift + P Open Command Palette
Ctrl + , Open app settings
Ctrl + K, Ctrl + S Display keyboard shortcuts
Ctrl + Shift + X Switch to Extensions pane
Ctrl + N New file
Ctrl + Shift + N New window
¹Ctrl + F4 Close file
Ctrl + Shift + W Close window
¹F11 Toggle Full Screen mode
Ctrl + B Toggle sidebar visibility
File Management
Ctrl + O Open file
Ctrl + S Save file
Ctrl + Shift + S Save as…
Ctrl + K, S Save all files
Ctrl + K, Ctrl + W Close all
Ctrl + Shift + T Reopen last closed
Editing Commands
Ctrl + C Copy selection or current line
Ctrl + X Cut selection or current line
Ctrl + V Paste
Ctrl + Shift + K Delete line
Home Go to beginning of line
End Go to end of line
Ctrl + Home Go to beginning of file
Ctrl + End Go to end of file
Alt + Up / Down Move line up or down
Ctrl + ] Indent line
Ctrl + [ Outdent line
Ctrl + / Comment out line
Shift + Alt + A Comment out region
Folding
Ctrl + Shift + [ Fold region
Ctrl + Shift + ] Unfold region
Ctrl + K, Ctrl + [ Fold all subregions
Ctrl + K, Ctrl + ] Unfold all subregions
Ctrl + K, Ctrl + 0 Fold all regions
Ctrl + K, Ctrl + J Unfold all regions
Editor Navigation
Ctrl + P Go to file
Ctrl + G Go to line
Ctrl + T Show all symbols
Ctrl + Shift + O Go to symbol
F8 Go to next error or warning
Shift + F8 Go to previous error or warning
Ctrl + Shift + M Show Problems panel
¹Alt + Left Go back
¹Alt + Right Go forward
Find and Replace
Ctrl + F Open Find dialog
Ctrl + H Open Replace dialog
Ctrl + Shift + H Replace in files
¹F3 Find next
¹Shift + F3 Find previous
Alt + Enter Select all matches for search term
Ctrl + D Add current selection to Find match
Ctrl + K, Ctrl + D Move previous selection to next Find match
Selection and Multiple Cursors
Ctrl + L Select current line
Ctrl + Shift + L Select all instances of current selection
Ctrl + F2 Select all matches of current word
¹Shift + Alt + Right Arrow Expand selection
¹Shift + Alt + Left Arrow Shrink selection
Alt + Click Insert cursor
Ctrl + Alt + Up Arrow / Down Arrow Insert cursor above or below current line
Ctrl + U Undo last cursor
Shift + Alt + I Insert cursor at the end of each selected line
Split Editor Management
Ctrl + Split editor
Ctrl + 1 / 2 / 3 Focus on editor pane 1, 2, or 3
Ctrl + K, Ctrl + Right Arrow / Left Arrow Focus on next / previous editor pane
¹Ctrl + Shift + PgUp Move editor left
¹Ctrl + Shift + PgDown Move editor right
Integrated Terminal
¹Ctrl + ` Show integrated terminal
¹Ctrl + Shift + ` Create new terminal instance
Ctrl + Up Arrow / Down Arrow Scroll up / down
Ctrl + Home / End Scroll to top / bottom
macOS-Specific Shortcuts
Cmd + W Close file
Cmd + Ctrl + F Toggle full screen
Cmd + – Go back
Cmd + Shift + – Go forward
Cmd + G Find next
Cmd + Shift + G Find previous
Cmd + Control + Shift + Right Arrow Expand selection
Cmd + Control + Shift + Left Arrow Shrink selection
Cmd + K, Cmd + Shift + Left Move editor left
Cmd + K, Cmd + Shift + Right Move editor right
Control + ` Show integrated terminal
Control + Shift + ` Create new terminal instance
¹The corresponding macOS shortcut is listed under the macOS-Specific Shortcuts section at the end of the cheat sheet.

Looking for More Ways to Make the Most of VS Code?

The keyboard shortcuts here will have you well on your way to becoming a Visual Studio Code power user. That said, there are many more ways that you can make the software even better-suited to your workflow.

For example, you can add countless features to the editor with extensions. If you’re looking for a starting point, take a look at our list of extensions to help make programming in VS Code even easier.

Image Credit: UserName on Unsplash

Read the full article: Essential Keyboard Shortcuts for Visual Studio Code

MakeUseOf