23 lesser known VS Code Shortcuts as GIF
Tags: vscode, productivity, shortcuts, codequality
Published: 2020-01-07 13:56:03

Despite many shortcuts I'm using frequently in VS Code, the following ones can come in very handy but I'm often forgetting they even exist. I made some GIFs for visualization to better remember them. Maybe there are some shortcuts you didn't remember either but are useful for you.

Every command in VS Code can also be executed via command prompt with `CTRL`+`SHIFT`+`P` and a search query. But knowing the direct shortcut might be faster.

*I use VS Code on Windows in the GIFs, but I also provide a table showing the shortcuts for both Windows and Mac for each command.*

## 1. `CTRL`+`,` = Open user settings

| Windows | Mac |
|---|---|
| `CTRL`+`,` | `⌘`+`,` |

![Open user settings in VS Code](https://thepracticaldev.s3.amazonaws.com/i/2kjznv0rzlcdyhgerdgw.gif)

Once in a while I need to adjust my user preferences, this is how you open them directly.

## 2. `CTRL`+`K` &nbsp; `CTRL`+`S` = Show shortcuts

| Windows | Mac |
|---|---|
| `CTRL`+`K` &nbsp; `CTRL`+`S` | `⌘`+`K` &nbsp; `⌘`+`S` |

![Show shortcuts in VS Code](https://thepracticaldev.s3.amazonaws.com/i/g8e3n7er0akxx3mudthl.gif)

This is the complete list of shortcuts in VS Code. There is also a [Windows Cheat-Sheet \[PDF\]](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf)  and [MacOS Cheat-Sheet \[PDF\]](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf) available to download.

## 3. `CTRL`+`R` = Switch workspace

| Windows | Mac |
|---|---|
| `CTRL`+`R` | `⌘`+`R` |

![Switch workspace in VS Code](https://thepracticaldev.s3.amazonaws.com/i/gopsstdhcylskfcadcex.gif)

This opens a list of your recent workspaces and is a super fast way to switch to another folder or project. Note that this will kill you current terminal session, if you had a terminal open in your VS Code workspace.

## 4. `ALT`+`Z` = Toggle word wrap

| Windows | Mac |
|---|---|
| `ALT`+`Z` | `⌥`+`Z` |

![Toggle word wrap in VS Code](https://thepracticaldev.s3.amazonaws.com/i/i4b8iabu7oj6u192pxcx.gif)

A handy little helper when you quickly want to see complete lines without scrolling horizontally.

## 5. `CTRL`+`G` = Go to line

| Windows | Mac |
|---|---|
| `CTRL`+`G` | `^`+`G` |

![Go to line in VS Code](https://thepracticaldev.s3.amazonaws.com/i/gfhbf62byf5pax90nccv.gif)

This is the shortcut for typing `CTRL`+`P` &nbsp; `:`.

## 6. `CTRL`+`P` = Go to file

| Windows | Mac |
|---|---|
| `CTRL`+`P` | `⌘`+`P` |

![Go to file in VS Code](https://thepracticaldev.s3.amazonaws.com/i/9z6jgt1j7bbd3siofc38.gif)

The fastest way to switch files (especially when they are not already open) without using the mouse.

## 7. `F8` = Go to next error or warning

| Windows | Mac |
|---|---|
| `F8` | `F8` |

![Go to next error or warning in VS Code](https://thepracticaldev.s3.amazonaws.com/i/9hfdq9o5fju2jqnph666.gif)

This is debugging with a single key. You can also go to previous errors or warnings using `SHIFT`+`F8`.

## 8. `CTRL`+`TAB` = Switch tabs

| Windows | Mac |
|---|---|
| `CTRL`+`TAB` | `^`+`TAB` |

![Switch tabs in VS Code](https://thepracticaldev.s3.amazonaws.com/i/a12k6ynovo9n69ftdno2.gif)

The fastest way to switch already open files without using the mouse.

## 9. `SHIFT`+`ALT`+`I` = Insert cursor at end of each line selected

| Windows | Mac |
|---|---|
| `SHIFT`+`ALT`+`I` | `⇧`+`⌥`+`I` |

![Insert cursor at end of each line selected in VS Code](https://thepracticaldev.s3.amazonaws.com/i/3mpyeapkciou9dwayqrv.gif)

This is useful for a quick creation of multiple cursors in the selected area.

## 10. `CTRL`+`L` = Select current line

| Windows | Mac |
|---|---|
| `CTRL`+`L` | `⌘`+`L` |

![Select current line in VS Code](https://thepracticaldev.s3.amazonaws.com/i/h5ndo2tgikqut8xjflwb.gif)

Use this i.e. to search for identical lines in combination with the next shortcut.

## 11. `CTRL`+`SHIFT`+`L` = Select all occurrences of current selection

| Windows | Mac |
|---|---|
| `CTRL`+`SHIFT`+`L` | `⇧`+`⌘`+`L` |

![Select all occurrences of current selection in VS Code](https://thepracticaldev.s3.amazonaws.com/i/zpjucdujh9kf2ppj3voo.gif)

This shortcut really saves time because you don't have to `CTRL`+`D` through a whole file.

## 12. `CTRL`+`F2` = Select all occurrences of current word

| Windows | Mac |
|---|---|
| `CTRL`+`F2` | `⌘`+`F2` |

![Select all occurrences of current word in VS Code](https://thepracticaldev.s3.amazonaws.com/i/9ueuvkwx1wv2xq55nrp7.gif)

With this you don't even have to select something anymore. Just place the cursor on the word you want to select all occurrences of.

## 13. `CTRL`+`SHIFT`+`SPACE` = Trigger parameter hints

| Windows | Mac |
|---|---|
| `CTRL`+`SHIFT`+`SPACE` | `⇧`+`⌘`+`SPACE` |

![Trigger parameter hints in VS Code](https://thepracticaldev.s3.amazonaws.com/i/6bef30r6o2kim1a941bq.gif)

In case you don't remember parameter order and don't want to interrupt your flow by looking into the docs.

## 14. `SHIFT`+`ALT`+`F` = Format document

| Windows | Mac |
|---|---|
| `SHIFT`+`ALT`+`F` | `⇧`+`⌥`+`F` |

![Format document in VS Code](https://thepracticaldev.s3.amazonaws.com/i/6rb2rccxqekf76rl7ozz.gif)

Because nobody wants to format a whole file manually.

## 15. `CTRL`+`K` &nbsp; `CTRL`+`F` = Format selection

| Windows | Mac |
|---|---|
| `CTRL`+`K` &nbsp; `CTRL`+`F` | `⌘`+`K` &nbsp; `⌘`+`F` |

![Format selection in VS Code](https://thepracticaldev.s3.amazonaws.com/i/aty1n0nx50kdewu3myig.gif)

In case you want to format only some parts of a file.

## 16. `F12` = Go to Definition

| Windows | Mac |
|---|---|
| `F12` | `F12` |

![Go to Definition in VS Code](https://thepracticaldev.s3.amazonaws.com/i/duaa9om5feqidwbpco47.gif)

The quick way to jump to the definition of a variable or function.

## 17. `ALT`+`F12` = Peek Definition

| Windows | Mac |
|---|---|
| `ALT`+`F12` | `⌥`+`F12` |

![Peek Definition in VS Code](https://thepracticaldev.s3.amazonaws.com/i/mh8y7rkl45gxgo78zzha.gif)

This just shows the corresponding definition of a variable or function without moving the cursor.

## 18. `F2` = Rename Symbol

| Windows | Mac |
|---|---|
| `F2` | `F2` |

![Rename Symbol in VS Code](https://thepracticaldev.s3.amazonaws.com/i/9w1txw0iobmgqoyuqa82.gif)

An indispensible shortcut for refactoring code.

## 19. `CTRL`+`K` &nbsp; `CTRL`+`X` = Trim trailing whitespace

| Windows | Mac |
|---|---|
| `CTRL`+`K` &nbsp; `CTRL`+`X` | `⌘`+`K` &nbsp; `⌘`+`X` |

![Trim trailing whitespace in VS Code](https://thepracticaldev.s3.amazonaws.com/i/uauvduxj4zrfp6587mt8.gif)

This is especially useful for multi-line selections.

## 20. `CTRL`+`K` &nbsp; `R` = Reveal active file in Explorer

| Windows | Mac |
|---|---|
| `CTRL`+`K` &nbsp; `R` | `⌘`+`K` &nbsp; `R` |

![Reveal active file in Explorer in VS Code](https://thepracticaldev.s3.amazonaws.com/i/ejh17k34nv5szu53m80v.gif)

In case you want to perform some actions out of your systems file manager instead of VS Code.

## 21. `CTRL`+`SHIFT`+`H` = Replace in files

| Windows | Mac |
|---|---|
| `CTRL`+`SHIFT`+`H` | `⇧`+`⌘`+`H` |

![Replace in files in VS Code](https://thepracticaldev.s3.amazonaws.com/i/tw962h7pzs41ln8g1inn.gif)

If only one file at a time isn't enough for you.

## 22. `CTRL`+`K` &nbsp; `V` = Open Markdown preview to the side

| Windows | Mac |
|---|---|
| `CTRL`+`K` &nbsp; `V` | `⌘`+`K` &nbsp; `V` |

![Open Markdown preview to the side in VS Code](https://thepracticaldev.s3.amazonaws.com/i/8mv90hojd7gbfgeq9g7r.gif)

This way you don't have to switch to the mouse to open a preview.

## 23. `CTRL`+`K` &nbsp; `Z` = Enter Zen Mode

| Windows | Mac |
|---|---|
| `CTRL`+`K` &nbsp; `Z` | `⌘`+`K` &nbsp; `Z` |

![Enter and exit Zen Mode in VS Code](https://thepracticaldev.s3.amazonaws.com/i/izqed88a5m6evkgknjs6.gif)

Instantly coding distraction free. To exit Zen mode, hit `ESC` `ESC`.

&nbsp;

So that's it for now. I maintain a repository on GitHub, where I collect commands I tend to forget - check it out if you want:

{% github devmount/CheatSheets no-readme %}

Happy Coding!

---

*Edited: 7th January 2020 (add MacOS shortcuts)
Published: 7th January 2020
Cover Image: https://codepen.io/devmount/full/ExaQjdm*