Visual Studio Code Shortcut Keys

Boost Your Efficiency: A Comprehensive Guide to Visual Studio Code Shortcut Keys

Introduction

vs code

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
↑&cmd;P, F1 Show Command Palette
&cmd;P Quick Open, Go to File…
↑&cmd;N New window/instance
&cmd;W Close window/instance
&cmd;, User Settings
&cmd;K &cmd;S Keyboard Shortcuts

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

Multi-cursor and selection
Action Shortcut
&option; + click Insert cursor
&option;&cmd;↑ Insert cursor above
&option;&cmd;↓ Insert cursor below
&cmd;U Undo last cursor operation
↑&cmd;I Insert cursor at end of each line selected
&cmd;L Select current line
↑&cmd;L Select all occurrences of current selection
&cmd;F2 Select all occurrences of current word
&control;&shift;&cmd;→ / ← Expand / shrink selection
↑&option; + drag mouse Column (box) selection
↑&option;&cmd;↑ / ↓ Column (box) selection up/down
↑&option;&cmd;← / → Column (box) selection left/right
↑&option;&cmd;PgUp; Column (box) selection page up
↑&option;&cmd;PgDn; Column (box) selection page down

Search and replace
Action Shortcut
&cmd;F Find
&option;&cmd;F Replace
&cmd;G / ↑&cmd;G Find next/previous
&option;Enter Select all occurrences of Find match
&cmd;D Add selection to next Find match
&cmd;K &cmd;D Move last selection to next Find match
Rich languages editing
Action Shortcut
&control;Space, &cmd;I Trigger suggestion
↑&cmd;Space Trigger parameter hints
↑&option;&cmd;F Format document
&cmd;K &cmd;F Format selection
F12 Go to Definition
&option;F12 Peek Definition
&cmd;K F12 Open Definition to the side
&cmd;. Quick Fix
&shift;F12 Show References
F2 Rename Symbol
&cmd;K &cmd;X Trim trailing whitespace
&cmd;K M Change file language

Navigation
Action Shortcut
&cmd;T Show all Symbols
&control;G Go to Line…
&cmd;P Go to File…
↑&cmd;O Go to Symbol…
↑&cmd;M Show Problems panel
F8 / &shift;F8 Go to next/previous error or warning
&control;&shift; Navigate editor group history
&control;- / &control;&shift;- Go back/forward
&control;&shift;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;&x 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;↑ / &cmd;↓ Move editor left/right
&cmd;↑↓ Move editor up/down
File management
Action Shortcut
&cmd;N New File
&cmd;O Open File…
&cmd;S Save
&shift;+&cmd;S Save As…
&cmd;K S Save All
&cmd;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
Ctrl+X Cut line (empty selection)
Ctrl+C Copy line (empty selection)
Alt+ ↓ / ↑ Move line down/up
Ctrl+Shift+K Delete line
Ctrl+Enter / Ctrl+Shift+Enter Insert line below/above
Ctrl+Shift+\ Jump to matching bracket
Ctrl+] / Ctrl+[ Indent/Outdent line
Home / End Go to beginning/end of line
Ctrl+ Home / End Go to beginning/end of file
Ctrl+ ↑ / ↓ Scroll line up/down
Alt+ PgUp / PgDn Scroll page up/down
Ctrl+Shift+ [ / ] Fold/unfold region
Ctrl+K Ctrl+ [ / ] Fold/unfold all subregions
Ctrl+K Ctrl+0 / Ctrl+K Ctrl+J Fold/Unfold all regions
Ctrl+K Ctrl+C Add line comment
Ctrl+K Ctrl+U Remove line comment
Ctrl+/ Toggle line comment
Ctrl+Shift+A Toggle block comment
Alt+Z Toggle word wrap

Rich languages editing
Action Shortcut
Ctrl+Space, Ctrl+I Trigger suggestion
Ctrl+Shift+Space Trigger parameter hints
Ctrl+Shift+I Format document
Ctrl+K Ctrl+F Format selection
F12 Go to Definition
Ctrl+Shift+F10 Peek Definition
Ctrl+K F12 Open Definition to the side
Ctrl+. Quick Fix
Shift+F12 Show References
F2 Rename Symbol
Ctrl+K Ctrl+X Trim trailing whitespace
Ctrl+K M Change file language
Multi-cursor and selection
Action Shortcut
Alt+Click Insert cursor*
Shift+Alt+ ↑ / ↓ Insert cursor above/below
Ctrl+U Undo last cursor operation
Shift+Alt+I Insert cursor at end of each line selected
Ctrl+L Select current line
Ctrl+Shift+L Select all occurrences of current selection
Ctrl+F2 Select all occurrences of current word
Shift+Alt + → Expand selection
Shift+Alt + ← Shrink selection
Shift+Alt + drag mouse Column (box) selection

Display
Action Shortcut
F11 Toggle full screen
Shift+Alt+0 Toggle editor layout (horizontal/vertical)
Ctrl+ = / - Zoom in/out
Ctrl+B Toggle Sidebar visibility
Ctrl+Shift+E Show Explorer / Toggle focus
Ctrl+Shift+F Show Search
Ctrl+Shift+G Show Source Control
Ctrl+Shift+D Show Debug
Ctrl+Shift+X Show Extensions
Ctrl+Shift+H Replace in files
Ctrl+Shift+J Toggle Search details
Ctrl+Shift+C Open new command prompt/terminal
Ctrl+K Ctrl+H Show Output panel
Ctrl+Shift+V Open Markdown preview
Ctrl+K V Open Markdown preview to the side
Ctrl+K Z Zen Mode (Esc Esc to exit)
Search and replace
Action Shortcut
Ctrl+F Find
Ctrl+H Replace
F3 / Shift+F3 Find next/previous
Alt+Enter Select all occurrences of Find match
Ctrl+D Add selection to next Find match
Ctrl+K Ctrl+D Move last selection to next Find match

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

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

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

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

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

Post a Comment

Comment Guidelines:
Respect others and their opinions.
Stay on topic and make sure your comment is relevant.
Avoid using offensive or inappropriate language.
Check your comment for spelling and grammar errors before posting.

For more details on our comment policy
-
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.