Master Visual Studio Code: Keyboard Shortcuts Keys to Boost Your Productivity

Unlock the power of Visual Studio with our curated list of 25 must-know keyboard shortcuts. Learn how to code faster, navigate effortlessly, and strea

Introduction

In the world of coding and programming, efficiency is key. One way to boost your productivity and streamline your workflow is by utilizing shortcut keys in your code editor.

Visual Studio Code (VS Code) is a popular choice among developers, and it offers a wide range of shortcut keys to help you navigate, edit, format, debug, and test your code more efficiently.

In this article, we will explore the essential shortcut keys for Windows, iOS, and Linux platforms, along with tips on customizing them to suit your needs.

Getting Started

Before diving into the shortcut keys, it's essential to know how to access them in VS Code.

You can easily find the list of shortcut keys by navigating to the Keyboard Shortcuts option in the settings.

Familiarize yourself with the concept of keybindings and how they allow you to perform specific actions quickly.


Windows Platform

For Windows users, there is a plethora of shortcut keys available in VS Code.

Whether you want to navigate between files, search for symbols, or refactor your code, there are shortcut keys to make these tasks a breeze.

Additionally, you'll discover shortcuts for code formatting, indentation, and debugging, enabling you to work seamlessly on your projects.

General

Action Shortcut
Show Action Palette Ctrl+Shift+P F1
Quick Open, Go to File… Ctrl+P
New window/instance Ctrl+Shift+N
Close window/instance Ctrl+Shift+W
User Settings Ctrl+
Keyboard Shortcuts Ctrl+K Ctrl+S

Basic editing

Action Shortcut
Cut line (empty selection) Ctrl+X
Copy line (empty selection) Ctrl+C
Move line up/down Alt+ ↑ / ↓
Copy line up/down Shift+Alt + ↓ / ↑
Delete line Ctrl+Shift+K
Insert line below Ctrl+Enter
Insert line above Ctrl+Shift+Enter
Jump to matching bracket Ctrl+Shift+\
Indent/outdent line Ctrl+] / [
Go to beginning/end of line Home / End
Go to beginning of file Ctrl+Home
Go to end of file Ctrl+End
Scroll line up/down Ctrl+↑ / ↓
Scroll page up/down Alt+PgUp / PgDn
Fold (collapse) region Ctrl+Shift+[
Unfold (uncollapse) region Ctrl+Shift+]
Fold (collapse) all subregions Ctrl+K Ctrl+[
Unfold (uncollapse) all subregions Ctrl+K Ctrl+]
Fold (collapse) all region Ctrl+K Ctrl+0
Unfold (uncollapse) all regions Ctrl+K Ctrl+J
Add line comment Ctrl+K Ctrl+C
Remove line comment Ctrl+K Ctrl+U
Toggle line comment Ctrl+/
Toggle block comment Shift+Alt+A
Toggle word wrap Alt+Z

Navigation

Action Shortcut
Show all Symbols Ctrl+T
Go to Line... Ctrl+G
Go to File... Ctrl+P
Go to Symbol... Ctrl+Shift+O
Show Problems panel Ctrl+Shift+M
Go to next error or warning F8
Go to previous error or warning Shift+F8
Navigate editor group history Ctrl+Shift+Tab
Go back / forward Alt+← / →
Toggle Tab moves focus Ctrl+M

Search and replace

Action Position
Find Ctrl+F
Replace Ctrl+H
Find next/previous F3 / Shift+F3
Select all occurrences of Find match Alt+Enter
Add selection to next Find match Ctrl+D
Move last selection to next Find match Ctrl+K Ctrl+D
Toggle case-sensitive / regex / whole word Alt+C / R / W

Multi-cursor and selection

Action Position
Insert cursor Alt+Click
Insert cursor above / below Ctrl+Alt+↑ / ↓
Undo last cursor operation Ctrl+U
Insert cursor at end of each line selected Shift+Alt+I
Select current line Ctrl+L
Select all occurrences of current selection Ctrl+Shift+L
Select all occurrences of current word Ctrl+F2
Expand selection Shift+Alt+→
Shrink selection Shift+Alt+←
Column (box) selection Shift+Alt + (drag mouse)
Column (box) selection Ctrl+Shift+Alt + (arrow key)
Column (box) selection page up/down Ctrl+Shift+Alt + PgUp/PgDn

Rich languages editing

Action Shortcut
Trigger suggestion Ctrl+Space Ctrl+I
Trigger parameter hints Ctrl+Shift+Space
Format document Shift+Alt+F
Format selection Ctrl+K Ctrl+F
Go to Definition F12
Peek Definition Alt+F12
Open Definition to the side Ctrl+K F12
Quick Fix Ctrl+.
Show References Shift+F12
Rename Symbol F2
Trim trailing whitespace Ctrl+K Ctrl+X
Change file language Ctrl+K M
Editor management
Close editor Ctrl+F4 Ctrl+W
Close folder Ctrl+K F
Split editor Ctrl+\
Focus into 1st, 2nd or 3rd editor group Ctrl+1 / 2 / 3
Focus into previous/next editor group Ctrl+K Ctrl+←/→
Move editor left/right Ctrl+Shift+PgUp / PgDn
Move active editor group Ctrl+K ← / →

File management

Action Position
New File Ctrl+N
Open File... Ctrl+O
Save Ctrl+S
Save As... Ctrl+Shift+S
Save All Ctrl+K S
Close Ctrl+F4
Close All Ctrl+K Ctrl+W
Reopen closed editor Ctrl+Shift+T
Keep preview mode editor open Ctrl+K Enter
Open next Ctrl+Tab
Open previous Ctrl+Shift+Tab
Copy path of active file Ctrl+K P
Reveal active file in Explorer Ctrl+K R
Show active file in new window/instance Ctrl+K O

Display

Action Position
Toggle full screen F11
Toggle editor layout (horizontal/vertical) Shift+Alt+0
Zoom in/out Ctrl+= / -
Toggle Sidebar visibility Ctrl+B
Show Explorer / Toggle focus Ctrl+Shift+E
Show Search Ctrl+Shift+F
Show Source Control Ctrl+Shift+G
Show Debug Ctrl+Shift+D
Show Extensions Ctrl+Shift+X
Replace in files Ctrl+Shift+H
Show Search details Ctrl+Shift+J
Show Output panel Ctrl+Shift+U
Open Markdown preview Ctrl+Shift+V
Open Markdown preview to the side Ctrl+K V
Zen Mode (Esc Esc to exit) Ctrl+K Z

Debug

Action Position
Toggle breakpoint F9
Start/Continue F5
Stop Shift+F5
Step into/out F11 / Shift+F11
Step over F10
Show hover Ctrl+K Ctrl+I

Integrated terminal

Action Position
Show integrated terminal Ctrl+`
Create new terminal Ctrl+Shift+`
Copy selection Ctrl+C
Paste into active terminal Ctrl+V
Scroll up/down Ctrl+↑ / ↓
Scroll page up/down Shift+PgUp / PgDn
Scroll to top/bottom Ctrl+Home / End

iOS Platform

If you're using VS Code on iOS, don't worry—there are plenty of shortcut keys for you too.

From basic navigation to advanced code editing and debugging, these shortcuts will help you become more efficient in your coding endeavors.

By leveraging these shortcuts, you can save time and streamline your iOS development workflow.

General

Action Shortcut
Ctrl+Shift+P, F1 Show Command Palette
Ctrl+P Quick Open, Go to File…
Ctrl+Shift+N New window/instance
Ctrl+W Close window/instance
Ctrl+, User Settings
Ctrl+K Ctrl+S Keyboard Shortcuts

Basic editing

Action Shortcut
+X Cut line (empty selection)
+C Copy line (empty selection)
+ / + Move line down/up
+ / + Copy line down/up
+K Delete line
+Enter / +Enter Insert line below/above
+\ Jump to matching bracket
+] / +] Indent/outdent line
Home / End Go to beginning/end of line
+ / + Go to beginning/end of file
+PgUp / +PgDn Scroll line up/down
+PgUp / +PgDn Scroll page up/down
++[ / ++] Fold/unfold region
+K +[ / +K +] Fold/unfold all subregions
+K +0 / +K +J Fold/unfold all regions
+K +C Add line comment
+K +U Remove line comment
+/ Toggle line comment
+A Toggle block comment
+Z Toggle word wrap

Multi-cursor and selection

Action Shortcut
+ click Insert cursor
Insert cursor above
Insert cursor below
+ U Undo last cursor operation
+ I Insert cursor at end of each line selected
+ L Select current line
+ L Select all occurrences of current selection
+ F2 Select all occurrences of current word
+ / Expand / shrink selection
+ drag mouse Column (box) selection
+ / Column (box) selection up/down
+ / Column (box) selection left/right
+ PgUp Column (box) selection page up
+ PgDn Column (box) selection page down

Search and replace

Action Shortcut
+F Find
++F Replace
+G / +G Find next/previous
+Enter Select all occurrences of Find match
+D Add selection to next Find match
+K +D Move last selection to next Find match

Rich languages editing

Action Shortcut
⌃Space, ⌘I Trigger suggestion
⌘Space Trigger parameter hints
⌘F Format document
⌘K ⌘F Format selection
F12 Go to Definition
⌥F12 Peek Definition
⌘K F12 Open Definition to the side
⌘. Quick Fix
F12 Show References
F2 Rename Symbol
⌘K ⌘X Trim trailing whitespace
⌘K M Change file language

Navigation

Action Shortcut
+T Show all Symbols
+G Go to Line…
+P Go to File…
++O Go to Symbol…
++M Show Problems panel
F8 / +F8 Go to next/previous error or warning
++Tab Navigate editor group history
+- / ++- Go back/forward
++M Toggle Tab moves focus

Editor management

Action Shortcut
Cmd+F4 Close
Cmd+K F Close folder
Cmd+W Close editor
Cmd+K Cmd+W Close all editors
Cmd+Up Arrow Split editor
Cmd+\\ Toggle editor group layout
Cmd+1 / Cmd+2 / Cmd+3 Focus into 1st, 2nd, 3rd editor group
Cmd+K Cmd+P Focus into previous part of the editor
Cmd+K Cmd+N Focus into next part of the editor
Cmd+Up Arrow / Cmd+Down Arrow Move editor left/right
Cmd+Up Arrow / Cmd+Down Arrow Move editor up/down

File management

Action Shortcut
+N New File
+O Open File…
+S Save
++S Save As…
+K S Save All
+W Close

Display

Action Shortcut
Cmd + + Zoom in
Cmd + - Zoom out
Cmd + Numpad0 Reset zoom

Linux Platform

Linux users also have access to a rich set of shortcut keys in VS Code.

Whether you're editing code, navigating through files, or utilizing the debugging tools, the Linux-specific shortcut keys will enhance your productivity.

Take advantage of these shortcuts to improve your coding speed and accuracy on the Linux platform.

General

Action Shortcut
Ctrl+Shift+P, F1 Show Command Palette
Ctrl+P Quick Open, Go to File...
Ctrl+Shift+N New window/instance
Ctrl+W Close window/instance
Ctrl+, User Settings
Ctrl+K Ctrl+S Keyboard Shortcuts

Basic editing

Action Shortcut
Cut line (empty selection) Ctrl+X
Copy line (empty selection) Ctrl+C
Move line down/up Alt+ ↓ / ↑
Delete line Ctrl+Shift+K
Insert line below/above Ctrl+Enter / Ctrl+Shift+Enter
Jump to matching bracket
Indent/Outdent line Ctrl+] / Ctrl+[
Go to beginning/end of line Home / End
Go to beginning/end of file Ctrl+ Home / End
Scroll line up/down Ctrl+ ↑ / ↓
Scroll page up/down Alt+ PgUp / PgDn
Fold/unfold region Ctrl+Shift+ [ / ]
Fold/unfold all subregions Ctrl+K Ctrl+ [ / ]
Fold/Unfold all regions Ctrl+K Ctrl+0 / Ctrl+K Ctrl+J
Add line comment Ctrl+K Ctrl+C
Remove line comment Ctrl+K Ctrl+U
Toggle line comment Ctrl+/
Toggle block comment Ctrl+Shift+A
Toggle word wrap Alt+Z

Rich languages editing

Action Shortcut
Trigger suggestion Ctrl+Space, Ctrl+I
Trigger parameter hints Ctrl+Shift+Space
Format document Ctrl+Shift+I
Format selection Ctrl+K Ctrl+F
Go to Definition F12
Peek Definition Ctrl+Shift+F10
Open Definition to the side Ctrl+K F12
Quick Fix Ctrl+.
Show References Shift+F12
Rename Symbol F2
Trim trailing whitespace Ctrl+K Ctrl+X
Change file language Ctrl+K M

Multi-cursor and selection

Action Shortcut
Insert cursor* Alt+Click
Insert cursor above/below Shift+Alt+ ↑ / ↓
Undo last cursor, operation Ctrl+U
Insert cursor at end of each line selected Shift+Alt+I
Select current line Ctrl+L
Select all occurrences of current selection Ctrl+Shift+L
Select all occurrences of current word Ctrl+F2
Expand selection Shift+Alt + →
Shrink selection Shift+Alt + ←
Column (box) selection Shift+Alt + drag mouse

Display

Action Shortcut
Toggle full screen F11
Toggle editor layout (horizontal/vertical) Shift+Alt+0
Zoom in/out Ctrl+= / -
Toggle Sidebar visibility Ctrl+B
Show Explorer / Toggle focus Ctrl+Shift+E
Show Search Ctrl+Shift+F
Show Source Control Ctrl+Shift+G
Show Debug Ctrl+Shift+D
Show Extensions Ctrl+Shift+X
Replace in files Ctrl+Shift+H
Toggle Search details Ctrl+Shift+J
Open new command prompt/terminal Ctrl+Shift+C
Show Output panel Ctrl+K Ctrl+H
Open Markdown preview Ctrl+Shift+V
Open Markdown preview to the side Ctrl+K V
Zen Mode (Esc Esc to exit) Ctrl+K Z

Search and replace

Action Shortcut
Find Ctrl + F
Replace Ctrl + H
Find next/previous F3 / Shift + F3
Select all occurrences of Find match Alt + Enter
Add selection to next Find match Ctrl + D
Move last selection to next Find match Ctrl + K Ctrl + D

Navigation

Action Shortcut
Show all Symbols Ctrl + T
Go to Line... Ctrl + G
Go to File... Ctrl + P
Show the Outline Ctrl + Shift + O
Show Problems panel Ctrl + Shift + M
Toggle Tab moves focus Ctrl + Shift + T

Editor management

Action Shortcut
Close editor Ctrl+F4, Ctrl+W
Split editor Ctrl+\\
Focus into 1st, 2nd, 3rd editor group Ctrl+1 / 2 / 3
Focus into previous/next editor group Ctrl+K Ctrl+ /
Move editor left/right Ctrl+Shift+PgUp / PgDn
Move active editor group Ctrl+K /

File management

Action Shortcut
New File Ctrl + N
Open File... Ctrl + O
Save Ctrl + S
Save As... Ctrl + Shift + S
Save All Ctrl + K S

Debug

Action Shortcut
Toggle breakpoint F9
Start/Continue F5
Step into/Step out F11 / Shift + F11
Step over F10
Stop Shift + F5
Show hover F1

Customizing Shortcut Keys

One of the great features of VS Code is the ability to customize shortcut keys according to your preferences.

You can modify existing keybindings or create your own custom combinations to suit your workflow and coding style.

This flexibility allows you to tailor VS Code to your specific needs and make your coding experience even more personalized.

Boosting Productivity with Shortcut Keys

Using shortcut keys is not just about memorizing combinations; it's about optimizing your workflow and increasing your productivity.

In this section, we will provide tips and tricks on effectively using shortcut keys, such as grouping related actions, creating macros, and taking advantage of context-aware keybindings.

We'll also explore how you can create your own custom keybindings to further enhance your coding efficiency.

Conclusion

Visual Studio Code shortcut keys are powerful tools that can significantly improve your coding experience.

By utilizing these shortcuts on Windows, iOS, or Linux platforms, you can navigate, edit, and debug your code more efficiently.

Customizing the shortcuts to fit your specific needs and adopting best practices for shortcut key usage will boost your productivity and make coding a more enjoyable experience.


Source:
Other operating systems’ keyboard shortcuts and additional unassigned shortcuts available ataka.ms/vscodekeybindings

About the author

🚀 | Exploring the realms of creativity and curiosity in 280 characters or less. Turning ideas into reality, one keystroke at a time. =» Ctrl + Alt + Believe

Post a Comment

-
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.