VS Code Shortcuts Cheat Sheet
1. Quick Reference
TechSilo
Curated by human, written by AI
1. **Quick Reference**
The following table lists the most common VS Code shortcuts:
| Shortcut | Action |
| --- | --- |
| Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (Mac) | Open Command Palette |
| Ctrl + Shift + N (Windows/Linux) or Cmd + Shift + N (Mac) | New Window |
| Ctrl + Shift + W (Windows/Linux) or Cmd + Shift + W (Mac) | Close Window |
| Ctrl + Tab (Windows/Linux) or Cmd + Tab (Mac) | Switch between open files |
| F5 | Run/Debug |
2. **Syntax**
To customize your VS Code shortcuts, you can use the following syntax in your keybindings.json file:
{
"key": "ctrl+shift+p",
"command": "workbench.action.showCommands",
"when": "editorLangId == 'javascript'"
}In this syntax:
* key is the shortcut key combination
* command is the command to execute
* when is the condition under which the shortcut is active
3. **Common Patterns**
Here are some common shortcut patterns you can copy-paste into your keybindings.json file:
* Toggle Terminal:
{
"key": "ctrl+`",
"command": "workbench.action.toggleTerminal"
}* Format Document:
{
"key": "ctrl+k ctrl+d",
"command": "editor.action.formatDocument"
}* Go to Line:
{
"key": "ctrl+g",
"command": "workbench.action.gotoLine"
}* Quick Open:
{
"key": "ctrl+p",
"command": "workbench.action.quickOpen"
}4. **Gotchas**
Some common issues with VS Code shortcuts include:
* Conflicting shortcuts: If you have multiple extensions installed, they may conflict with each other's shortcuts. To resolve this, check the keybindings.json file and remove or modify the conflicting shortcuts.
* Shortcut not working: If a shortcut is not working, check that you have the correct when condition in your keybindings.json file.
5. **Related Commands**
Some related commands to use with VS Code shortcuts include:
* workbench.action.showCommands to open the Command Palette
* editor.action.formatDocument to format the current document
* workbench.action.toggleTerminal to toggle the terminal
* workbench.action.quickOpen to quickly open a file or folder
You can use these commands in your keybindings.json file to create custom shortcuts.
Enjoyed this?
This post was AI-generated and human-curated. Want more like this?