cheat-sheets

VSCode (Visual Studio Code)

Free, extensible code editor from Microsoft.

Documentation: VS Code Docs

macOS shortcuts: VSCode shortcuts (macOS)

Shortcuts (Windows / Linux) #

SHORTCUTACTION
Ctrl+Shift+P / F1Command Palette
Ctrl+PQuick open file
Ctrl+Shift+NNew window
Ctrl+,Settings
Ctrl+BToggle sidebar
`Ctrl+``Toggle terminal
Ctrl+Shift+E / F / G / XExplorer / Search / Source control / Extensions
Ctrl+Shift+FSearch across files
Ctrl+F / Ctrl+HFind / Replace
Ctrl+GGo to line
Ctrl+Shift+OGo to symbol in file
F12 / Alt+F12Go to definition / Peek definition
Shift+F12Find all references
F2Rename symbol
Ctrl+.Quick fix
Alt+Up / Alt+DownMove line
Shift+Alt+Up / Shift+Alt+DownCopy line
Ctrl+Shift+KDelete line
Ctrl+/Toggle line comment
Shift+Alt+AToggle block comment
Ctrl+DSelect next occurrence
Ctrl+Shift+LSelect all occurrences
Alt+ClickAdd a cursor
Ctrl+Alt+Up / DownAdd a cursor above / below
Shift+Alt+FFormat document
Ctrl+K ZZen mode
Ctrl+K Ctrl+SKeyboard shortcuts

Command Line #

COMMANDDESCRIPTION
code .Open the current folder
code -r <FILE>Reuse the existing window
code --diff <A> <B>Compare two files
code --goto <FILE>:<LINE>Open at a line
code --list-extensionsList installed extensions
code --install-extension <PUBLISHER.NAME>Install an extension
code --uninstall-extension <PUBLISHER.NAME>Remove an extension
code --list-extensions | xargs -L1 echo code --install-extensionGenerate commands to reinstall extensions elsewhere
code --profile <NAME> .Open with a profile

Useful settings.json #

json
{
  "editor.formatOnSave": true,
  "editor.minimap.enabled": false,
  "editor.rulers": [80, 120],
  "editor.bracketPairColorization.enabled": true,
  "files.trimTrailingWhitespace": true,
  "files.insertFinalNewline": true,
  "files.autoSave": "onFocusChange",
  "terminal.integrated.scrollback": 10000,
  "workbench.startupEditor": "none"
}

Handy Extensions #

EXTENSIONUSE
ms-vscode-remote.remote-sshEdit on remote hosts over SSH
ms-vscode-remote.remote-containersDevelop inside containers
ms-azuretools.vscode-dockerDocker and Compose support
redhat.vscode-yamlYAML schema validation
ms-kubernetes-tools.vscode-kubernetes-toolsKubernetes
hashicorp.terraformTerraform
redhat.ansibleAnsible
timonwong.shellcheckShell script linting
eamodio.gitlensGit blame and history
yzhang.markdown-all-in-oneMarkdown editing
EditorConfig.EditorConfigRespect .editorconfig
Search all sheets

Tip: / or Ctrl/Cmd+K to open, Esc to close.