VS Code Keyboard Shortcuts

Unlock the full potential of Visual Studio Code with our comprehensive guide on essential VS Code keyboard shortcuts. This article dives deep into the most useful key bindings, customization tips, and hidden gems that can significantly boost your productivity.

Whether coding in JavaScript, Python, or HTML, learn how to navigate, edit, and manage your workspace effortlessly. Perfect for developers looking to enhance their coding efficiency and optimize their development environment.

FAQ on VS Code Keyboard Shortcuts

What are the most useful keyboard shortcuts in Visual Studio Code?

Some of my go-to shortcuts in Visual Studio Code include Ctrl + Shift + P to open the Command Palette, Ctrl + P for quick file navigation, Ctrl + / to toggle line comments, and Ctrl + B to show or hide the sidebar. These shortcuts enhance productivity and streamline my workflow.

How can I customize keyboard shortcuts in VS Code?

To customize shortcuts, go to File > Preferences > Keyboard Shortcuts or use Ctrl + K, Ctrl + S. There, you can modify existing shortcuts or add new ones by editing the keybindings.json file. This allows me to tailor my VS Code experience to match my coding style and preferences.

Is there a cheat sheet for VS Code keyboard shortcuts?

Absolutely! The official documentation offers a comprehensive cheat sheet that’s invaluable. You can also find various community-generated cheat sheets that cover common key bindings, code navigation shortcuts, debugging commands, and more. Having a quick reference guide handy is super helpful.

How do I reset VS Code keyboard shortcuts to default?

Accidentally messed up your shortcuts? No worries. You can reset them by opening the Command Palette (Ctrl + Shift + P) and typing “Preferences: Open Keyboard Shortcuts (JSON)”. Delete the customizations there to revert to the default settings. It’s a quick way to start fresh.

What keyboard shortcuts are specific to certain programming languages in VS Code?

Sure, language-specific shortcuts can be a game changer. For instance, F12 jumps to definitions in JavaScript or TypeScript files, while Ctrl + Shift + I formats code in Python. This flexibility across different languages, like HTML and CSS, makes life much easier.

How do I create custom keyboard shortcuts for extensions in VS Code?

Creating custom shortcuts for extensions is straightforward. Use Ctrl + Shift + P to open the Command Palette, then search for “Preferences: Open Keyboard Shortcuts” or manually navigate to it. From there, search for the extension’s commands and assign your preferred shortcuts.

Can I export and import keyboard shortcuts in VS Code?

Definitely! Simply open keybindings.json via Ctrl + K, Ctrl + S, copy the content, and save it somewhere safe. To import, replace your current keybindings.json content with the saved file. This is super handy when switching between different machines or sharing preferences.

Are there shortcuts for managing Git within VS Code?

Yes, there are several. Ctrl + Shift + G opens the Source Control panel. Navigating Git commands like commit (Ctrl + Enter), stage (Ctrl + Shift + A), and initialize repository (Ctrl + Shift + I) becomes seamless. These shortcuts bring Git integration right into your development workspace.

What are some lesser-known but useful shortcuts in VS Code?

One hidden gem is Alt + Shift + Drag for selecting rectangular areas of code. Another is Ctrl + Shift + L to select all occurrences of the current selection. Don’t forget Ctrl + \ to split the editor window. These lesser-known shortcuts can be real time-savers.

How do I find and change key bindings in VS Code?

To find or change key bindings, use Ctrl + Shift + P and type “Preferences: Open Keyboard Shortcuts”. You can search for specific commands and modify their key bindings directly. Alternatively, open keybindings.json for more advanced customization. This process is intuitive and lets you optimize your coding environment.

And here’s the table with all the Visual Studio Code keyboard shortcuts

In case the searchable table doesn’t load. 

KeysAction
Ctrl + XCut line (empty selection)
Ctrl + CCopy line (empty selection)
Ctrl + VPaste
Ctrl + Shift + KDelete Line
Ctrl + EnterInsert Line Below
Ctrl + Shift + EnterInsert Line Above
Alt + DownMove Line Down
Alt + UpMove Line Up
Shift + Alt + DownCopy Line Down
Shift + Alt + UpCopy Line Up
Ctrl + ZUndo
Ctrl + YRedo
Ctrl + DAdd Selection To Next Find Match
Ctrl + K Ctrl + DMove Last Selection To Next Find Match
Ctrl + UUndo last cursor operation
Shift + Alt + IInsert cursor at end of each line selected
Ctrl + Shift + LSelect all occurrences of current selection
Ctrl + F2Select all occurrences of current word
Ctrl + LSelect current line
Ctrl + Alt + DownInsert Cursor Below
Ctrl + Alt + UpInsert Cursor Above
Ctrl + Shift + \Jump to matching bracket
Ctrl + ]Indent Line
Ctrl + [Outdent Line
HomeGo to Beginning of Line
EndGo to End of Line
Ctrl + EndGo to End of File
Ctrl + HomeGo to Beginning of File
Ctrl + DownScroll Line Down
Ctrl + UpScroll Line Up
Alt + PageDownScroll Page Down
Alt + PageUpScroll Page Up
Ctrl + Shift + [Fold (collapse) region
Ctrl + Shift + ]Unfold (uncollapse) region
Ctrl + K Ctrl + LToggle Fold region
Ctrl + K Ctrl + [Fold (collapse) all subregions
Ctrl + K Ctrl + ]Unfold (uncollapse) all subregions
Ctrl + K Ctrl + 0Fold (collapse) all regions
Ctrl + K Ctrl + JUnfold (uncollapse) all regions
Ctrl + K Ctrl + CAdd Line Comment
Ctrl + K Ctrl + URemove Line Comment
Ctrl + /Toggle Line Comment
Shift + Alt + AToggle Block Comment
Ctrl + FFind
Ctrl + HReplace
EnterFind Next
Shift + EnterFind Previous
Alt + EnterSelect All Occurrences of Find Match
Alt + CToggle Find Case Sensitive
Alt + RToggle Find Regex
Alt + WToggle Find Whole Word
Ctrl + MToggle Use of Tab Key for Setting Focus
Alt + ZToggle Word Wrap
Ctrl + SpaceTrigger Suggest
Ctrl + Shift + SpaceTrigger Parameter Hints
Shift + Alt + FFormat Document
Ctrl + K Ctrl + FFormat Selection
F12Go to Definition
Ctrl + K Ctrl + IShow Hover
Alt + F12Peek Definition
Ctrl + K F12Open Definition to the Side
Ctrl + .Quick Fix
Shift + F12Go to References
F2Rename Symbol
Ctrl + Shift + .Replace with Next Value
Ctrl + Shift + ,Replace with Previous Value
Shift + Alt + RightExpand AST Selection
Shift + Alt + LeftShrink AST Selection
Ctrl + K Ctrl + XTrim Trailing Whitespace
Ctrl + K MChange Language Mode
Ctrl + TShow All Symbols
Ctrl + GGo to Line…
Ctrl + PGo to File…, Quick Open
Ctrl + Shift + OGo to Symbol…
Ctrl + Shift + MShow Problems
F8Go to Next Error or Warning
Shift + F8Go to Previous Error or Warning
Ctrl + Shift + PShow All Commands
F1Show All Commands
Ctrl + TabNavigate Editor Group History
Alt + LeftGo Back
Alt + RightGo Forward
Ctrl + K LeftMove Active Editor Group Left
Ctrl + K RightMove Active Editor Group Right
Ctrl + Shift + NNew Window
Alt + F4Close Window
Ctrl + F4Close Editor
Ctrl + K FClose Folder
Ctrl + \Split Editor
Ctrl + 1Focus into First Editor Group
Ctrl + 2Focus into Second Editor Group
Ctrl + 3Focus into Third Editor Group
Ctrl + Shift + PageUpMove Editor Left
Ctrl + Shift + PageDownMove Editor Right
Ctrl + Alt + RightMove Editor into Next Group
Ctrl + Alt + LeftMove Editor into Previous Group
Ctrl + NNew File
Ctrl + OOpen File…
Ctrl + SSave
Ctrl + K SSave All
Ctrl + Shift + SSave As…
Ctrl + K WClose Group
Ctrl + K Ctrl + WClose All
Ctrl + Shift + TReopen Closed Editor
Ctrl + K EnterKeep Open
Ctrl + K PCopy Path of Active File
Ctrl + K RReveal Active File in Windows
F11Toggle Full Screen
Ctrl + K ZToggle Zen Mode
Escape EscapeLeave Zen Mode
Ctrl +=Zoom in
Ctrl + –Zoom out
Ctrl + Numpad0Reset Zoom
Ctrl + BToggle Sidebar Visibility
Ctrl + Shift + EShow Explorer / Toggle Focus
Ctrl + Shift + FShow Search
Ctrl + Shift + GShow Source Control
Ctrl + Shift + DShow Run
Ctrl + Shift + XShow Extensions
Ctrl + Shift + UShow Output
Ctrl + QQuick Open View
Ctrl + Shift + COpen New Command Prompt
Ctrl + Shift + VToggle Markdown Preview
Ctrl + K VOpen Preview to the Side
Ctrl + `Toggle Integrated Terminal
Ctrl + ,Open Settings
Ctrl + K Ctrl + SOpen Keyboard Shortcuts
Ctrl + K Ctrl + TSelect Color Theme
F9Toggle Breakpoint
F5Start
Ctrl + F5Start (without debugging)
F6Pause
Ctrl + Shift + BRun Build Task
7328cad6955456acd2d75390ea33aafa?s=250&d=mm&r=g VS Code Keyboard Shortcuts
Related Posts