VS Code Guide
A comprehensive guide to Visual Studio Code โ shortcuts, extensions, debugging, Git integration, multi-cursor, Emmet, remote development, and more. Every code block has a Copy button.
Copy button on each code block ยท โ Beginner โ Intermediate โ Advanced01 Introduction โ What is VS Code?
Visual Studio Code (VS Code) is a free, open-source code editor developed by Microsoft. It runs on Windows, macOS, and Linux, and supports hundreds of programming languages out of the box. With its rich extension ecosystem, integrated terminal, debugger, and Git support, VS Code has become the most popular developer editor worldwide.
Key features include:
- IntelliSense โ smart code completions based on language semantics
- Built-in Git โ stage, commit, push, pull, and resolve conflicts without leaving the editor
- Integrated Terminal โ full shell access right in the editor
- Debugger โ set breakpoints, inspect variables, and step through code
- Extensions โ thousands of community-built plugins for languages, themes, and tools
- Remote Development โ connect to WSL, containers, or SSH servers
02 Installation & First Launch Beginner
Download & Install
- Linux (Debian/Ubuntu): Download
.debfrom code.visualstudio.com or usesudo snap install code --classic - Linux (Fedora): Download
.rpmfrom code.visualstudio.com - macOS: Download
.zipfrom code.visualstudio.com orbrew install --cask visual-studio-code - Windows: Download the installer from code.visualstudio.com
Launch from Terminal
# Open VS Code in the current directory
code .
# Open a specific file
code index.js
# Open and wait for the window to close (useful for Git commit messages)
code --wait file.txt
# Open without a window (add to PATH during install on Windows/macOS)
code --help
Shell Command: Install 'code' command in PATH, and run it to enable the code terminal command.First Launch Checklist
- Open the Command Palette (Ctrl+Shift+P) and try typing commands
- Toggle the Explorer sidebar (Ctrl+B)
- Open the Extensions panel (Ctrl+Shift+X) and search for a theme
- Open the Integrated Terminal (Ctrl+`)
03 Interface Overview Beginner
VS Code's interface is divided into five main areas:
Common View Commands
# Toggle Sidebar visibility
Ctrl+B
# Toggle Panel visibility
Ctrl+J
# Toggle Sidebar orientation (left/right)
# Context menu on Activity Bar โ Move Sidebar Right/Left
# Zen Mode โ full-screen, distraction-free editing
Ctrl+K Z
# Toggle Minimap (code overview on the right edge)
Ctrl+Shift+P โ "View: Toggle Minimap"
# Split editor vertically
Ctrl+\
04 Essential Keyboard Shortcuts Beginner
These shortcuts will save you the most time. Windows/Linux keys shown; macOS users replace Ctrl with Cmd and Alt with Option.
05 Command Palette Beginner
The Command Palette is the single most important feature in VS Code. Press Ctrl+Shift+P and start typing to access almost every command in the editor.
Common Palette Commands
# Toggle settings
> Preferences: Open Settings (UI)
# Install extensions
> Extensions: Install Extensions
# Change color theme
> Preferences: Color Theme
# Change file icon theme
> Preferences: File Icon Theme
# Open keyboard shortcuts
> Preferences: Open Keyboard Shortcuts
# Format document
> Format Document
# Toggle line numbers
> View: Toggle Line Numbers
# Reopen closed tab
> Workbench: Reopen Closed Editor
? in the palette to see available special prefixes: > for commands, @ for symbols, : for line numbers, and # for file names.Quick Open (Ctrl+P)
Press Ctrl+P and type part of a filename to navigate instantly. Add modifiers:
@โ go to a symbol within the current file:โ go to a specific line (e.g.,:42)#โ search across all files for a symbol>โ open the Command Palette (same as Ctrl+Shift+P)
06 Integrated Terminal Beginner
The integrated terminal gives you a full shell inside VS Code. Open it with Ctrl+` (backtick).
Terminal Management
# Open a new terminal instance
Ctrl+Shift+`
# Switch between terminals
Ctrl+PageUp / Ctrl+PageDown
# Open terminal in a specific folder
# Click + dropdown โ Select Default Profile โ Choose folder
# Create a split terminal (side by side)
# Right-click terminal tab โ Split, or Ctrl+Shift+5
# Clear terminal
# Type 'clear' in the terminal or click trash icon
# Open file links in terminal output
# Ctrl+Click on a file:line in terminal output
Default Shell
You can change the default shell via the Command Palette: Terminal: Select Default Profile. Options include:
- bash, zsh, fish (Linux/macOS)
- PowerShell, Command Prompt, Git Bash (Windows)
- WSL (Windows Subsystem for Linux)
07 Extensions Beginner
Extensions are what make VS Code infinitely customizable. Open the Extensions panel with Ctrl+Shift+X.
Essential Extensions
Extension Management Commands
# Open Extensions panel
Ctrl+Shift+X
# Install from command line
code --install-extension esbenp.prettier-vscode
# List installed extensions
code --list-extensions
# Disable all extensions (troubleshooting)
code --disable-extensions
@category:"formatters" or @recommended in the Extensions panel to find curated lists.08 Settings & Customization Intermediate
VS Code settings are stored in settings.json. You can edit them via the UI (Ctrl+,) or directly in JSON.
Open Settings
# Open Settings UI
Ctrl+,
# Open settings.json directly
Ctrl+Shift+P โ "Preferences: Open Settings (JSON)"
# Open workspace settings (project-specific)
# .vscode/settings.json in your project root
Popular Settings
{
// Editor appearance
"editor.fontSize": 14,
"editor.fontFamily": "'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace",
"editor.fontLigatures": true,
"editor.lineHeight": 24,
"editor.minimap.enabled": true,
"editor.renderWhitespace": "boundary",
"editor.bracketPairColorization.enabled": true,
// Format on save
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
// Word wrap
"editor.wordWrap": "on",
// Auto save
"files.autoSave": "onFocusChange",
// Tab size
"editor.tabSize": 2,
"editor.insertSpaces": true,
// Explorer
"explorer.compactFolders": false,
"explorer.confirmDragAndDrop": false,
// Terminal
"terminal.integrated.fontSize": 13,
"terminal.integrated.defaultProfile.linux": "bash",
// Git
"git.enableSmartCommit": true,
"git.autofetch": true
}
Settings Layers
- User Settings โ apply to every project (global)
- Workspace Settings โ stored in
.vscode/settings.json, shared with the team - Folder Settings โ apply to a specific folder in a multi-root workspace
09 Snippets Intermediate
Snippets let you insert repetitive code blocks quickly by typing a prefix and pressing Tab.
Built-in Snippets
VS Code comes with built-in snippets for many languages. For example, in JavaScript/TypeScript:
// Type 'log' and press Tab
console.log();
// Type 'fn' in JS/TS
function name() {
}
// Type 'for' โ for loop
for (let index = 0; index < array.length; index++) {
const element = array[index];
}
// Type 'clg' in JS
console.log()
Create Your Own Snippets
// Open: Command Palette โ Preferences: Configure User Snippets
// Choose a language or create a global one
{
// Example: React functional component snippet
"React Functional Component": {
"prefix": "rfc",
"body": [
"import React from 'react';",
"",
"const ${1:ComponentName} = () => {",
" return (",
" <div>$0</div>",
" );",
"};",
"",
"export default ${1:ComponentName};"
],
"description": "React Functional Component"
}
}
$1, $2 are tab stops. $0 is the final cursor position. ${1:default} creates a placeholder with default text. Wrap in ${1|a,b|} for a choice list.10 Debugging Intermediate
VS Code has a built-in debugger that supports Node.js, Python, Java, C++, and more via extensions.
Getting Started
# Open Run and Debug panel
Ctrl+Shift+D
# Start debugging (F5)
F5
# Toggle breakpoint (click gutter or F9)
F9
# Step over
F10
# Step into
F11
# Step out
Shift+F11
# Continue (resume execution)
F5
# Stop debugging
Shift+F5
# Restart debugging
Ctrl+Shift+F5
Launch Configuration
Create a .vscode/launch.json file. Here's an example for Node.js:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/index.js"
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"port": 9229
}
]
}
${workspaceFolder} โ current project root, ${file} โ currently open file, ${lineNumber} โ current line, ${env:VAR} โ environment variable.Debug Features
- Watch โ track variable expressions
- Call Stack โ see the execution path
- Variables โ inspect local, global, and closure variables
- Logpoints โ log messages without stopping (right-click gutter โ Add Logpoint)
- Conditional Breakpoints โ break only when an expression is true
11 Git Integration Intermediate
VS Code has deep Git integration built in. Open the Source Control panel with Ctrl+Shift+G.
Common Git Actions
# Open Source Control panel
Ctrl+Shift+G
# Stage file changes (click + next to file)
# Stage all: hover "Changes" โ click +
# Commit staged changes
# Type message in input box โ Ctrl+Enter
# Pull latest
# Click ... โ Pull, or run in terminal
# Push commits
# Click ... โ Push, or run in terminal
# View git history for a file
# Right-click in editor โ Git: View History
# Open diff view
# Click a modified file in Source Control panel
# Discard changes
# Right-click file โ Discard Changes
GitLens (Recommended Extension)
GitLens supercharges the Git experience by adding:
- Inline blame annotations โ see who last modified each line
- Code lens โ show commit info above functions
- File history โ rich timeline view
- Branch visualization โ interactive rebase UI
"git.enableSmartCommit": true in settings to stage all changes when you type a commit message, skipping the staging step.12 Multiple Cursors & Selection Intermediate
Multi-cursor editing lets you make the same edit in multiple places simultaneously โ one of VS Code's most powerful features.
Multi-Cursor Techniques
# Add cursor at next occurrence of selection
Ctrl+D
# Add cursor at every occurrence of selection
Ctrl+Shift+L
# Add cursor above/below
Ctrl+Alt+โ / Ctrl+Alt+โ
# Add cursor at arbitrary locations
# Alt+Click to add a cursor wherever you click
# Undo last cursor action
Ctrl+U
# Select all occurrences of current word
Ctrl+Shift+L
# Cancel multi-cursor
Esc
Practical Workflows
- Rename a variable โ select the variable, press Ctrl+Shift+L, type the new name
- Edit multiple lines โ select lines, press Ctrl+Shift+L, edit all at once
- Add commas/semicolons โ Alt+Shift+I to add a cursor at the end of every line in a selection
- Column selection โ hold Shift+Alt and drag to select a rectangular block
13 Find & Replace Beginner
In the Current File
# Find
Ctrl+F
# Find and replace
Ctrl+H
# Toggle case sensitivity (Aa button)
Alt+C
# Toggle whole word match (Ab button)
Alt+W
# Toggle regex mode (.* button)
Alt+R
# Find next / previous
Enter / Shift+Enter
# Close find widget
Esc
Across All Files (Search)
# Open Search (global find)
Ctrl+Shift+F
# Search and replace across files
Ctrl+Shift+H
# Include/exclude files (use glob patterns)
# In the "files to include" box: src/**/*.js
# In the "files to exclude" box: node_modules, dist
# Toggle search details
# Click the ellipsis (...) in the Search panel
# Preview search results inline
# Results show a snippet of matching lines
Useful Regex Patterns
14 Emmet Intermediate
Emmet lets you write HTML and CSS at lightning speed using CSS-like abbreviations. Built into VS Code for HTML, CSS, JSX, and more.
HTML Abbreviations
// Type and press Tab
// Basic structure
! โ <!DOCTYPE html>... (full HTML5 boilerplate)
// Elements
div โ <div></div>
p โ <p></p>
a โ <a href=""></a>
img โ <img src="" alt="" />
// Nesting
nav>ul>li โ <nav><ul><li></li></ul></nav>
// Siblings
div+p+bq โ <div></div><p></p><blockquote></blockquote>
// Multiplication
ul>li*5 โ <ul><li>*5</li></ul>
// IDs and classes
div#header โ <div id="header"></div>
div.container โ <div class="container"></div>
// Attributes
a[href="https://example.com"] โ <a href="https://example.com"></a>
// Text
p{Hello} โ <p>Hello</p>
// Numbered items
ul>li.item$*3 โ <ul><li class="item1"></li>...</ul>
CSS Abbreviations
// Properties
m โ margin: ;
p โ padding: ;
c โ color: #000;
bg โ background: #000;
bgc โ background-color: #000;
ff โ font-family: ;
fs โ font-size: ;
fw โ font-weight: ;
ta:c โ text-align: center;
d:f โ display: flex;
jc:c โ justify-content: center;
ai:c โ align-items: center;
bdrs โ border-radius: ;
// Vendor prefixes
// Many are handled automatically
Emmet: Wrap with Abbreviation to wrap existing code with an Emmet expression.15 Tasks & Build Systems Advanced
Tasks let you run tools like build scripts, linters, test runners, or any shell command directly from VS Code.
Create a Task
Create a .vscode/tasks.json file:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build Project",
"type": "shell",
"command": "npm run build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$tsc"]
},
{
"label": "Run Tests",
"type": "shell",
"command": "npm test",
"group": "test"
},
{
"label": "Lint",
"type": "shell",
"command": "npm run lint"
}
]
}
Run a Task
- Ctrl+Shift+B โ run the default build task
- Ctrl+Shift+P โ
Tasks: Run Taskโ pick any defined task - Tasks output goes to the Terminal panel, with error markers parsed by
problemMatcher
Problem Matchers
Problem matchers parse compiler/linter output and highlight issues inline. Built-in matchers include:
$tscโ TypeScript compiler$eslint-compactโ ESLint compact format$eslint-stylishโ ESLint stylish format$gccโ GCC/G++$jshintโ JSHint
tasks.json problemMatcher object.16 Remote Development Advanced
With the Remote Development extension pack, VS Code can open folders on remote machines, containers, or WSL as if they were local.
Remote Options
Quick Start: SSH Remote
# Install "Remote โ SSH" extension
# Open Command Palette โ Remote-SSH: Connect to Host
# Or open from terminal
code --remote ssh-remote+dev.example.com /path/to/project
# Add SSH hosts to your config (~/.ssh/config)
Host dev-server
HostName 192.168.1.100
User ubuntu
IdentityFile ~/.ssh/id_ed25519
Quick Start: Dev Containers
# Create .devcontainer/devcontainer.json in your project
{
"name": "Node.js Dev",
"image": "mcr.microsoft.com/devcontainers/javascript-node:18",
"forwardPorts": [3000],
"extensions": ["dbaeumer.vscode-eslint"],
"postCreateCommand": "npm install"
}
# Open Command Palette
# โ Dev Containers: Reopen in Container
17 Keyboard Shortcuts Reference Beginner
Windows/Linux keys shown. macOS: replace Ctrl โ Cmd, Alt โ Option.