VS Code keyboard shortcuts
Every VS Code keyboard shortcut from Microsoft's official reference, with the keys for Mac, Windows and Linux side by side.
Essential VS Code keyboard shortcuts
The VS Code shortcuts that save the most time. Keys are shown for every system; the Mac and Windows pages show one system only.
- Command PaletteMacShiftCmdPorF1WindowsCtrlShiftPorF1LinuxCtrlShiftPorF1
- Go to fileMacCmdPWindowsCtrlPLinuxCtrlP
- Go to lineMacCtrlGWindowsCtrlGLinuxCtrlG
- Comment or uncomment lineMacCmd/WindowsCtrl/LinuxCtrl/
- Select next match (multi-cursor)MacCmdDWindowsCtrlDLinuxCtrlD
- Move line downMacOption↓WindowsAlt↓LinuxAlt↓
- Duplicate line downMacOptionShift↓WindowsAltShift↓LinuxCtrlAltShift↓
- Delete lineMacShiftCmdKWindowsCtrlShiftKLinuxCtrlShiftK
- Format documentMacOptionShiftFWindowsAltShiftFLinuxCtrlShiftI
- Go to definitionMacF12WindowsF12LinuxF12
- Rename symbolMacF2WindowsF2LinuxF2
- Split editorMacCmd\WindowsCtrl\LinuxCtrl\
General
7 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Show Command Palette | ShiftCmdPorF1 | CtrlShiftPorF1 | CtrlShiftPorF1 |
| Quick Open, go to file | CmdP | CtrlP | CtrlP |
| New window | ShiftCmdN | CtrlShiftN | CtrlShiftN |
| Close window | ShiftCmdW | CtrlShiftW | CtrlShiftW |
| Open User Settings | Cmd, | Ctrl, | Ctrl, |
| Open the keybindings editor | CmdK,CmdS | CtrlK,CtrlS | CtrlK,CtrlS |
| Open Microsoft's shortcut reference | CmdK,CmdR | CtrlK,CtrlR | CtrlK,CtrlR |
Basic editing
33 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Cut line (empty selection) | CmdX | CtrlX | CtrlX |
| Copy line (empty selection) | CmdC | CtrlC | CtrlC |
| Move line down | Option↓ | Alt↓ | Alt↓ |
| Move line up | Option↑ | Alt↑ | Alt↑ |
| Copy line down | OptionShift↓ | AltShift↓ | CtrlAltShift↓ |
| Copy line up | OptionShift↑ | AltShift↑ | CtrlAltShift↑ |
| Delete line | ShiftCmdK | CtrlShiftK | CtrlShiftK |
| Insert line below | CmdEnter | CtrlEnter | CtrlEnter |
| Insert line above | ShiftCmdEnter | CtrlShiftEnter | CtrlShiftEnter |
| Jump to matching bracket | ShiftCmd\ | CtrlShift\ | CtrlShift\ |
| Indent line | Cmd] | Ctrl] | Ctrl] |
| Outdent line | Cmd[ | Ctrl[ | Ctrl[ |
| Go to beginning of line | HomeorCmd← | Home | Home |
| Go to end of line | EndorCmd→ | End | End |
| Go to beginning of file | Cmd↑ | CtrlHome | CtrlHome |
| Go to end of file | Cmd↓ | CtrlEnd | CtrlEnd |
| Scroll line up | CtrlPageUp | Ctrl↑ | Ctrl↑ |
| Scroll line down | CtrlPageDown | Ctrl↓ | Ctrl↓ |
| Scroll page up | CmdPageUp | AltPageUp | AltPageUp |
| Scroll page down | CmdPageDown | AltPageDown | AltPageDown |
| Fold (collapse) region | OptionCmd[ | CtrlShift[ | CtrlShift[ |
| Unfold (uncollapse) region | OptionCmd] | CtrlShift] | CtrlShift] |
| Toggle fold | CmdK,CmdL | CtrlK,CtrlL | CtrlK,CtrlL |
| Fold all subregions | CmdK,Cmd[ | CtrlK,Ctrl[ | CtrlK,Ctrl[ |
| Unfold all subregions | CmdK,Cmd] | CtrlK,Ctrl] | CtrlK,Ctrl] |
| Fold all regions | CmdK,Cmd0 | CtrlK,Ctrl0 | CtrlK,Ctrl0 |
| Unfold all regions | CmdK,CmdJ | CtrlK,CtrlJ | CtrlK,CtrlJ |
| Fold all block comments | CmdK,Cmd/ | CtrlK,Ctrl/ | CtrlK,Ctrl/ |
| Add line comment | CmdK,CmdC | CtrlK,CtrlC | CtrlK,CtrlC |
| Remove line comment | CmdK,CmdU | CtrlK,CtrlU | CtrlK,CtrlU |
| Toggle line comment | Cmd/ | Ctrl/ | Ctrl/ |
| Toggle block comment | OptionShiftA | AltShiftA | CtrlShiftA |
| Toggle word wrap | OptionZ | AltZ | AltZ |
Navigation
10 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Show all symbols | CmdT | CtrlT | CtrlT |
| Go to line | CtrlG | CtrlG | CtrlG |
| Go to symbol in file | ShiftCmdO | CtrlShiftO | CtrlShiftO |
| Show Problems panel | ShiftCmdM | CtrlShiftM | CtrlShiftM |
| Go to next error or warning | F8 | F8 | F8 |
| Go to previous error or warning | ShiftF8 | ShiftF8 | ShiftF8 |
| Navigate editor group history | CtrlShiftTab | CtrlShiftTab | CtrlShiftTab |
| Go back | Ctrl- | Alt← | CtrlAlt- |
| Go forward | CtrlShift- | Alt→ | CtrlShift- |
| Toggle Tab moves focus | CtrlShiftM | CtrlM | CtrlM |
Search and replace
8 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Find | CmdF | CtrlF | CtrlF |
| Replace | OptionCmdF | CtrlH | CtrlH |
| Find nextFind widget open | EnterorCmdG | EnterorF3 | EnterorF3 |
| Find previousFind widget open | ShiftEnterorShiftCmdG | ShiftEnterorShiftF3 | ShiftEnterorShiftF3 |
| Select all occurrences of find matchFind widget open | OptionEnter | AltEnter | AltEnter |
| Toggle case-sensitiveFind widget open | OptionCmdC | AltC | AltC |
| Toggle regexFind widget open | OptionCmdR | AltR | AltR |
| Toggle whole wordFind widget open | OptionCmdW | AltW | AltW |
Multi-cursor and selection
11 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Insert cursor above | OptionCmd↑ | CtrlAlt↑ | AltShift↑ |
| Insert cursor below | OptionCmd↓ | CtrlAlt↓ | AltShift↓ |
| Undo last cursor operation | CmdU | CtrlU | CtrlU |
| Insert cursor at end of each selected line | OptionShiftI | AltShiftI | AltShiftI |
| Select current line | CmdL | CtrlL | CtrlL |
| Select all occurrences of current selection | ShiftCmdL | CtrlShiftL | CtrlShiftL |
| Add selection to next find match | CmdD | CtrlD | CtrlD |
| Select all | CmdA | CtrlA | CtrlA |
| Expand selection | CtrlShiftCmd→ | AltShift→ | AltShift→ |
| Shrink selection | CtrlShiftCmd← | AltShift← | AltShift← |
| Column (box) selection down | OptionShiftCmd↓ | CtrlAltShift↓ | CtrlAltShift↓ |
Rich languages editing
12 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Trigger suggestion | CtrlSpaceorCmdI | CtrlSpaceorCtrlI | CtrlSpaceorCtrlI |
| Trigger parameter hints | ShiftCmdSpace | CtrlShiftSpace | CtrlShiftSpace |
| Format document | OptionShiftF | AltShiftF | CtrlShiftI |
| Format selection | CmdK,CmdF | CtrlK,CtrlF | CtrlK,CtrlF |
| Go to definition | F12 | F12 | F12 |
| Peek definition | OptionF12 | AltF12 | CtrlShiftF10 |
| Open definition to the side | CmdK,F12 | CtrlK,F12 | CtrlK,F12 |
| Quick Fix | Cmd. | Ctrl. | Ctrl. |
| Show references | ShiftF12 | ShiftF12 | ShiftF12 |
| Rename symbol | F2 | F2 | F2 |
| Trim trailing whitespace | CmdK,CmdX | CtrlK,CtrlX | CtrlK,CtrlX |
| Change file language | CmdK,M | CtrlK,M | CtrlK,M |
Editor management
10 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Close editor | CmdW | CtrlWorCtrlF4 | CtrlW |
| Close folder | CmdK,F | CtrlK,F | CtrlK,F |
| Split editor | Cmd\ | Ctrl\ | Ctrl\ |
| Focus into 1st, 2nd or 3rd editor group | Cmd1 | Ctrl1 | Ctrl1 |
| Focus into previous editor group | CmdK,Cmd← | CtrlK,Ctrl← | CtrlK,Ctrl← |
| Focus into next editor group | CmdK,Cmd→ | CtrlK,Ctrl→ | CtrlK,Ctrl→ |
| Move editor left | CmdK,ShiftCmd← | CtrlShiftPageUp | CtrlShiftPageUp |
| Move editor right | CmdK,ShiftCmd→ | CtrlShiftPageDown | CtrlShiftPageDown |
| Move active editor group left | CmdK,← | CtrlK,← | CtrlK,← |
| Move active editor group right | CmdK,→ | CtrlK,→ | CtrlK,→ |
File management
14 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Open folder | CmdO | CtrlK,CtrlO | CtrlK,CtrlO |
| New file | CmdN | CtrlN | CtrlN |
| Open file | CmdO | CtrlO | CtrlO |
| Save | CmdS | CtrlS | CtrlS |
| Save as | ShiftCmdS | CtrlShiftS | CtrlShiftS |
| Save all | OptionCmdS | CtrlK,S | CtrlK,S |
| Close all editors | CmdK,CmdW | CtrlK,CtrlW | CtrlK,CtrlW |
| Reopen closed editor | ShiftCmdT | CtrlShiftT | CtrlShiftT |
| Keep preview mode editor open | CmdK,Enter | CtrlK,Enter | CtrlK,Enter |
| Open next editor | CtrlTab | CtrlTab | CtrlTab |
| Open previous editor | CtrlShiftTab | CtrlShiftTab | CtrlShiftTab |
| Copy path of active file | CmdK,P | CtrlK,P | CtrlK,P |
| Reveal active file in Explorer or Finder | CmdK,R | CtrlK,R | CtrlK,R |
| Show active file in new window | CmdK,O | CtrlK,O | CtrlK,O |
Display
17 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Toggle full screen | CtrlCmdF | F11 | F11 |
| Toggle Zen Mode | CmdK,Z | CtrlK,Z | CtrlK,Z |
| Zoom in | Cmd= | Ctrl= | Ctrl= |
| Zoom out | Cmd- | Ctrl- | Ctrl- |
| Toggle Sidebar visibility | CmdB | CtrlB | CtrlB |
| Show Explorer | ShiftCmdE | CtrlShiftE | CtrlShiftE |
| Show Search | ShiftCmdF | CtrlShiftF | CtrlShiftF |
| Show Source Control | CtrlShiftG | CtrlShiftG | CtrlShiftG |
| Show Run and Debug | ShiftCmdD | CtrlShiftD | CtrlShiftD |
| Show Extensions | ShiftCmdX | CtrlShiftX | CtrlShiftX |
| Replace in files | ShiftCmdH | CtrlShiftH | CtrlShiftH |
| Toggle Search details | ShiftCmdJ | CtrlShiftJ | CtrlShiftJ |
| Show Output panel | ShiftCmdU | CtrlShiftU | CtrlK,CtrlH |
| Toggle panel | CmdJ | CtrlJ | CtrlJ |
| Show Debug Console | ShiftCmdY | CtrlShiftY | CtrlShiftY |
| Open Markdown preview | ShiftCmdV | CtrlShiftV | CtrlShiftV |
| Open Markdown preview to the side | CmdK,V | CtrlK,V | CtrlK,V |
Debug
8 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Toggle breakpoint | F9 | F9 | F9 |
| Start or continue debugging | F5 | F5 | F5 |
| Start without debugging | CtrlF5 | CtrlF5 | CtrlF5 |
| Stop debugging | ShiftF5 | ShiftF5 | ShiftF5 |
| Step into | F11 | F11 | F11 |
| Step out | ShiftF11 | ShiftF11 | ShiftF11 |
| Step over | F10 | F10 | F10 |
| Show hover | CmdK,CmdI | CtrlK,CtrlI | CtrlK,CtrlI |
Integrated terminal
8 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Toggle integrated terminal | Ctrl` | Ctrl` | Ctrl` |
| Create new terminal | CtrlShift` | CtrlShift` | CtrlShift` |
| Scroll up (terminal)Terminal focused | Cmd↑ | CtrlShift↑ | CtrlShift↑ |
| Scroll down (terminal)Terminal focused | Cmd↓ | CtrlShift↓ | CtrlShift↓ |
| Scroll page up (terminal)Terminal focused | PageUp | ShiftPageUp | ShiftPageUp |
| Scroll page down (terminal)Terminal focused | PageDown | ShiftPageDown | ShiftPageDown |
| Scroll to top (terminal)Terminal focused | CmdHome | CtrlHome | CtrlHome |
| Scroll to bottom (terminal)Terminal focused | CmdEnd | CtrlEnd | CtrlEnd |
No shortcuts match. Try fewer words, the key names only, or search every app.
Show the key map: which keys VS Code uses mostDarker orange = used by more shortcuts
Open a folder, files and windows in VS Code
To open a folder in VS Code from the keyboard, press Ctrl+K Ctrl+O on Windows and Linux, or Cmd+O on a Mac, and choose the folder.
- Open folderMacCmdOWindowsCtrlK,CtrlOLinuxCtrlK,CtrlO
- Open fileMacCmdOWindowsCtrlOLinuxCtrlO
- New fileMacCmdNWindowsCtrlNLinuxCtrlN
- New windowMacShiftCmdNWindowsCtrlShiftNLinuxCtrlShiftN
- Close folderMacCmdK,FWindowsCtrlK,FLinuxCtrlK,F
- Reopen closed editorMacShiftCmdTWindowsCtrlShiftTLinuxCtrlShiftT
- Open a recent folder
- Ctrl+R opens the list of recent folders and workspaces; type to filter it and press Enter.
- From a terminal
- Type code . to open the current folder in VS Code. On a Mac, run "Shell Command: Install 'code' command in PATH" from the Command Palette first.
Explorer, Search, Extensions, panel and terminal shortcuts
The views in the sidebar each have a shortcut. Press the same shortcut again, or Ctrl+B (Cmd+B on Mac), to hide the sidebar.
- Explorer viewMacShiftCmdEWindowsCtrlShiftELinuxCtrlShiftE
- Search viewMacShiftCmdFWindowsCtrlShiftFLinuxCtrlShiftF
- Source Control viewMacCtrlShiftGWindowsCtrlShiftGLinuxCtrlShiftG
- Run and Debug viewMacShiftCmdDWindowsCtrlShiftDLinuxCtrlShiftD
- Extensions viewMacShiftCmdXWindowsCtrlShiftXLinuxCtrlShiftX
- Show or hide the sidebarMacCmdBWindowsCtrlBLinuxCtrlB
- Show or hide the panelMacCmdJWindowsCtrlJLinuxCtrlJ
- TerminalMacCtrl`WindowsCtrl`LinuxCtrl`
- New terminalMacCtrlShift`WindowsCtrlShift`LinuxCtrlShift`
- ProblemsMacShiftCmdMWindowsCtrlShiftMLinuxCtrlShiftM
- OutputMacShiftCmdUWindowsCtrlShiftULinuxCtrlK,CtrlH
- Debug ConsoleMacShiftCmdYWindowsCtrlShiftYLinuxCtrlShiftY
- Filter the Extensions view
- In the Extensions view's search box, type @installed, @enabled or @disabled to list those extensions, or @recommended for suggestions for your project.
VS Code code folding shortcuts
Folding hides a block of code behind one line. Fold the block at the cursor, fold everything, or unfold it all again from the keyboard.
- Fold the block at the cursorMacOptionCmd[WindowsCtrlShift[LinuxCtrlShift[
- Unfold the block at the cursorMacOptionCmd]WindowsCtrlShift]LinuxCtrlShift]
- Toggle foldMacCmdK,CmdLWindowsCtrlK,CtrlLLinuxCtrlK,CtrlL
- Fold allMacCmdK,Cmd0WindowsCtrlK,Ctrl0LinuxCtrlK,Ctrl0
- Unfold allMacCmdK,CmdJWindowsCtrlK,CtrlJLinuxCtrlK,CtrlJ
- Fold all inner blocksMacCmdK,Cmd[WindowsCtrlK,Ctrl[LinuxCtrlK,Ctrl[
- Unfold all inner blocksMacCmdK,Cmd]WindowsCtrlK,Ctrl]LinuxCtrlK,Ctrl]
- Fold all block commentsMacCmdK,Cmd/WindowsCtrlK,Ctrl/LinuxCtrlK,Ctrl/
- Fold to a level
- Ctrl+K Ctrl+1 folds every block at level 1, Ctrl+K Ctrl+2 at level 2, and so on up to 7 (Cmd+K Cmd+1 on Mac).
- Your own regions
- In many languages, lines such as // #region and // #endregion mark a block you can fold, even when it is not a function or class.
GitHub Copilot keyboard shortcuts in VS Code
With GitHub Copilot turned on, these keys handle its suggestions and chat. They come from GitHub's and Microsoft's documentation rather than the core list above, and can change between Copilot releases.
- Accept or dismiss a suggestion
- Tab accepts the grey inline suggestion and Esc dismisses it. Ctrl+Right Arrow (Cmd+Right Arrow on Mac) accepts it one word at a time.
- See other suggestions
- Alt+] shows the next suggestion and Alt+[ the previous one (Option+] and Option+[ on Mac). Alt+\ (Option+\) asks for a suggestion straight away.
- Chat
- Ctrl+Alt+I (Ctrl+Cmd+I on Mac) opens the Chat view, and Ctrl+I (Cmd+I) opens inline chat in the editor, replacing Trigger suggestion on that key.
- Check your version
- Search "copilot" in the Keyboard Shortcuts editor to see the keys your version uses and change them.
- Continue and other AI extensions
- Extensions such as Continue add their own shortcuts, and some replace VS Code defaults. Search the extension's name in the Keyboard Shortcuts editor to see and change them.
Change and reset VS Code keyboard shortcuts in the Keyboard Shortcuts editor
Every shortcut is listed and changed in the Keyboard Shortcuts editor. Open it with Ctrl+K Ctrl+S (Cmd+K Cmd+S on Mac), or File > Preferences > Keyboard Shortcuts (Code > Settings > Keyboard Shortcuts on Mac).
- Keyboard Shortcuts editorMacCmdK,CmdSWindowsCtrlK,CtrlSLinuxCtrlK,CtrlS
- SettingsMacCmd,WindowsCtrl,LinuxCtrl,
- Keyboard Shortcuts ReferenceMacCmdK,CmdRWindowsCtrlK,CtrlRLinuxCtrlK,CtrlR
- What the editor shows
- A searchable table with four columns: Command, Keybinding, When (where the shortcut works) and Source (Default, User or an extension).
- Change a shortcut
- Double-click a row, press the new keys and press Enter. Press Esc to cancel.
- Search by keys
- Click Record Keys (the keyboard icon in the search box) and press a shortcut to see every command bound to it.
- Find clashes
- Right-click a row and choose Show Same Keybindings to list other commands on the same keys.
- Edit as JSON
- Run "Preferences: Open Keyboard Shortcuts (JSON)" from the Command Palette to edit keybindings.json, where your changes are stored.
- Shortcuts from another editor
- Ctrl+K Ctrl+M lists keymap extensions that bring the shortcuts of Sublime Text, IntelliJ, Vim and other editors.
- Reset one shortcut
- In the Keyboard Shortcuts editor, right-click the shortcut and choose Reset Keybinding.
- See what you changed
- Type @source:user in the editor's search box to list only your own shortcuts.
- Reset all shortcuts
- Open keybindings.json ("Preferences: Open Keyboard Shortcuts (JSON)"), delete everything between the square brackets so only [] is left, and save.
- Extension shortcuts
- If a keymap or other extension changed your keys, disable or uninstall it from the Extensions view; its shortcuts go with it.
VS Code keyboard shortcuts: questions
- How do I open keyboard shortcuts settings in VS Code?
- Press Ctrl+K Ctrl+S (Cmd+K Cmd+S on Mac) to open the Keyboard Shortcuts editor, where you can search, change and reset every shortcut. More in Keyboard Shortcuts editor.
- How do I reset all keyboard shortcuts in VS Code?
- Open keybindings.json with "Preferences: Open Keyboard Shortcuts (JSON)", leave only [] and save. To reset one shortcut, right-click it in the Keyboard Shortcuts editor and choose Reset Keybinding.
- What is the shortcut to open a folder in VS Code?
- Ctrl+K Ctrl+O on Windows and Linux, and Cmd+O on a Mac. Ctrl+R opens a recent folder.
- How do I open the Extensions view?
- Press Ctrl+Shift+X (Cmd+Shift+X on Mac).
- How do I show or hide the panel in VS Code?
- Press Ctrl+J (Cmd+J on Mac). Ctrl+` opens the terminal in the panel directly.
- How do I fold all code in VS Code?
- Ctrl+K Ctrl+0 folds everything and Ctrl+K Ctrl+J unfolds it (Cmd+K on Mac). See code folding shortcuts.
- Are VS Code shortcuts different on Mac and Windows?
- Mostly Cmd replaces Ctrl, with a few exceptions. See VS Code keyboard shortcuts for Mac and VS Code keyboard shortcuts for Windows for one system at a time.
- Is there a VS Code keyboard shortcuts PDF?
- Yes: the printable VS Code keyboard shortcuts cheat sheet for Windows, Mac or Linux prints on one or two pages or saves as a PDF.
These are the default key bindings in Visual Studio Code 1.96, as published by Microsoft. Shortcuts that need an extension, an add-in or a changed keymap are left out. Where two combinations do the same thing, both are shown.
Single-system lists: VS Code keyboard shortcuts for Mac, VS Code keyboard shortcuts for Windows, VS Code keyboard shortcuts for Linux.
Each shortcut has its own page with the keys for every system, related shortcuts and the same action in other apps. The printable cheat sheet fits the whole list on one or two pages.