Skip to main content

πŸ–₯️ VS Code Installation and Configuration

Visual Studio Code is where you'll spend most of your working hours, so it's worth setting up well. This lesson takes you from installation to a tuned, professional workspace β€” themes and fonts, the powerful settings.json file, the integrated terminal, Git integration, and the shortcuts that make editing feel effortless.

🎯 Learning Objectives

By the end of this lesson, you will be able to:

  • Install VS Code and the code command on Windows, macOS, or Linux
  • Customize theme, icons, and a programming font with ligatures
  • Edit settings.json directly to configure format-on-save and other defaults
  • Use core features β€” the integrated terminal, Git panel, IntelliSense, and multi-cursor editing
  • Work faster with the Command Palette and essential keyboard shortcuts

Estimated Time: 40–50 minutes  β€’  Difficulty: Beginner

Hands-on: Configure your own settings.json and drill the multi-cursor and Command Palette workflows.

In This Lesson

Why VS Code?

Your code editor is a craftsperson's workbench β€” the place you return to for thousands of hours. Visual Studio Code has become the default choice for web developers because it hits a rare sweet spot: light and fast like a text editor, yet extensible into a full IDE when you need it.

  • Free & open source, cross-platform (Windows, macOS, Linux).
  • Huge extension ecosystem β€” add exactly the language support and tools you want.
  • Built-in IntelliSense, Git, and terminal β€” the essentials come out of the box.
  • Ubiquitous β€” Stack Overflow's developer surveys have ranked it the most-used editor by a wide margin for years, so help is everywhere.
πŸ’‘ Analogy: VS Code is like a modular workbench that starts nearly bare but accepts any attachment. You bolt on only the tools your project needs, so it never feels bloated β€” and it reshapes itself for JavaScript, Python, or PHP on demand.

Installing VS Code

Use your package manager from the tools lesson β€” it's the fastest route and keeps VS Code updatable with one command.

Windows

# Windows Package Manager (built in)
winget install Microsoft.VisualStudioCode

# or Chocolatey
choco install vscode -y

When installing via the graphical installer instead, tick "Add to PATH" and "Register Code as an editor for supported file types" β€” the PATH option is what makes the code command work later.

macOS

brew install --cask visual-studio-code

Linux (Ubuntu / Debian)

# Snap β€” simplest
sudo snap install --classic code

# or via Microsoft's APT repository for automatic updates
sudo apt install wget gpg -y
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -D -o root -g root -m 644 microsoft.gpg /etc/apt/keyrings/microsoft.gpg
echo "deb [arch=amd64,arm64 signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
sudo apt update
sudo apt install code -y

⚠️ apt-key is deprecated

Older tutorials use apt-key add, which modern Ubuntu has removed. The gpg --dearmor + signed-by approach above is the current, secure way to trust a repository's key.

The code Command

The real magic connecting the last two lessons is the code shell command. From any terminal you can launch the editor exactly where you're standing:

code .                 # open the current folder as a project
code app.js            # open a single file
code ~/projects/site   # open a specific folder
code --diff a.js b.js  # open a side-by-side diff of two files

code . becomes muscle memory: cd into a project, type it, and your whole codebase opens. On Windows and Linux the package-manager install wires this up automatically. On macOS, enable it once from inside VS Code:

  1. Open the Command Palette with Cmd+Shift+P.
  2. Type "shell command".
  3. Choose "Shell Command: Install 'code' command in PATH".

βœ… Terminal + editor, unified

This one command is why the terminal and VS Code feel like a single tool. You navigate and run commands in the shell, then drop into the editor for the same folder without touching the mouse.

Appearance: Theme & Font

Appearance isn't vanity β€” the right theme and font reduce eye strain and help you read code faster over long sessions.

Color theme

Press Ctrl+K Ctrl+T (Cmd+K Cmd+T on macOS) to browse themes instantly. Built-ins are good; popular installs include One Dark Pro, Dracula, and Night Owl (dark) or GitHub Light (light).

Icon theme

An icon theme makes the file explorer far easier to scan. Material Icon Theme is the community favorite. Install from the Extensions view (Ctrl+Shift+X), then set it via the Command Palette β†’ "File Icon Theme".

Programming font with ligatures

Coding fonts like JetBrains Mono, Fira Code, or Cascadia Code render clearly and support ligatures β€” where character pairs such as => or !== combine into a single, cleaner glyph. Install the font on your OS, then point VS Code at it (next section).

πŸ“– What's a ligature?

A ligature is a single glyph drawn for a sequence of characters. In code fonts, ->, >=, and === are rendered as unified symbols. It's purely visual β€” the underlying text is unchanged β€” but many developers find it easier to read.

Configuring settings.json

VS Code has a friendly Settings UI (Ctrl+,), but every setting is ultimately stored in a JSON file β€” and editing it directly is faster, shareable, and how you'll see settings described online. Open it from the Command Palette β†’ "Preferences: Open User Settings (JSON)".

{
  // --- Appearance ---
  "workbench.colorTheme": "Default Dark Modern",
  "editor.fontFamily": "'JetBrains Mono', 'Fira Code', Consolas, monospace",
  "editor.fontSize": 14,
  "editor.fontLigatures": true,

  // --- Sensible editing defaults ---
  "editor.tabSize": 2,
  "editor.formatOnSave": true,
  "editor.wordWrap": "on",
  "files.autoSave": "onFocusChange",
  "files.trimTrailingWhitespace": true,
  "files.insertFinalNewline": true,

  // --- Terminal ---
  "terminal.integrated.fontSize": 13
}

πŸ’‘ The setting that pays for itself: formatOnSave

With "editor.formatOnSave": true and a formatter like Prettier installed, every save tidies your indentation and spacing automatically. You stop thinking about formatting entirely β€” and every file in a team stays consistent.

πŸ“– User vs Workspace settings

User settings apply to every project on your machine. Workspace settings live in a project's .vscode/settings.json and are committed to Git, so the whole team shares the same tab-size and formatter. Workspace settings override user settings for that project.

Features That Earn Their Keep

graph TD A[VS Code core features] --> B[IntelliSense] A --> C[Integrated terminal] A --> D[Source control / Git] A --> E[Multi-cursor editing] A --> F[Global search & replace] A --> G[Command Palette]

IntelliSense

Context-aware completion for variables, functions, and APIs. It pops up as you type, or on demand with Ctrl+Space. Hover any symbol to see its type and documentation β€” like an assistant that memorized every API for you.

Integrated terminal

Open it with Ctrl+` (backtick). It's a full shell inside the editor, so you run npm, git, and python without leaving VS Code. Split it or spin up multiple terminals for a server and a build watcher side by side.

Git integration

The Source Control panel (Ctrl+Shift+G) shows changed files, lets you stage and commit, and visualizes diffs β€” all without memorizing Git commands. The gutter marks added and modified lines as you edit.

Multi-cursor editing

Edit many places at once. The workhorse is Ctrl+D (Cmd+D): select a word, then press it repeatedly to add a cursor at each next occurrence and type once to change them all.

// Select 'color', press Ctrl+D three times β†’ four cursors,
// then type 'theme' once to rename every occurrence at once.
const color = getColor();
applyColor(color);
saveColor(color);
console.log(color);

Global search & replace

Ctrl+Shift+F searches the whole project; toggle the regex button for pattern-based find-and-replace across every file at once.

Keyboard Shortcuts

The single most useful shortcut is the Command Palette: Ctrl+Shift+P (Cmd+Shift+P). It's a searchable menu of every command in VS Code and its extensions β€” if you can name it, you can run it without hunting through menus.

ActionWindows / LinuxmacOS
Command PaletteCtrl+Shift+PCmd+Shift+P
Quick Open fileCtrl+PCmd+P
Toggle terminalCtrl+`Cmd+`
Toggle sidebarCtrl+BCmd+B
Add next occurrence (multi-cursor)Ctrl+DCmd+D
Move line up/downAlt+↑ / ↓Option+↑ / ↓
Copy line up/downShift+Alt+↑ / ↓Shift+Option+↑ / ↓
Comment lineCtrl+/Cmd+/
Format documentShift+Alt+FShift+Option+F
Go to definitionF12F12

πŸ’‘ Emmet bonus

In an HTML file, type ul>li*3 and press Tab β€” VS Code's built-in Emmet expands it into a <ul> with three <li> children instantly. Try ! then Tab for a full HTML5 boilerplate.

Hands-on Exercise

πŸ‹οΈ Tune your editor, then drill the workflow

Objective: Make VS Code yours and practice the moves that save the most time.

Part A β€” configure

  1. Install a programming font (JetBrains Mono or Fira Code) on your OS.
  2. Open User Settings (JSON) from the Command Palette and paste the settings block from this lesson, adjusting the font to what you installed.
  3. Install the Prettier extension so formatOnSave has a formatter to call.
  4. Save a messy file and watch it auto-format.

Part B β€” drill the shortcuts

  1. Create index.html, type ! and press Tab to scaffold it with Emmet.
  2. Add ul>li*5 + Tab to generate a list.
  3. Use Ctrl+D to select a repeated word and rename all occurrences at once.
  4. Open the integrated terminal with Ctrl+` and run node -v.
  5. Do everything above without touching the mouse.
πŸ’‘ Hint β€” nothing formats on save?

Format-on-save needs a formatter for that language. Install Prettier, then right-click in the file β†’ "Format Document With…" β†’ set Prettier as the default. Confirm "editor.formatOnSave": true is present in your settings JSON with no typos (JSON is picky about commas).

βœ… What success looks like

Your editor shows your chosen font with ligatures, saving reflows the code automatically, Emmet expands abbreviations, and you completed Part B entirely from the keyboard. That keyboard-first flow is exactly how experienced developers work.

🎯 Quick Quiz

Question 1: What does typing code . in a terminal do?

Question 2: Which setting automatically tidies your formatting every time you save?

Question 3: You need to rename a variable that appears many times in one file. What's the fastest built-in way?

Summary & Quiz

πŸŽ‰ Key Takeaways

  • Install VS Code via your package manager and enable the code command so code . opens any project.
  • Tune theme, icons, and a ligature font for readable, comfortable coding.
  • settings.json is the real source of truth; formatOnSave is the highest-value setting to turn on.
  • Lean on IntelliSense, the integrated terminal, Git panel, and multi-cursor editing daily.
  • The Command Palette (Ctrl+Shift+P) reaches every command β€” learn it before anything else.

πŸ“š Further Reading

πŸš€ What's Next?

A bare VS Code is capable, but its real power comes from extensions. Next we'll install the essential extensions for web development β€” linters, formatters, and language tools that turn the editor into a tailored full-stack IDE.

πŸŽ‰ Workbench dialed in!

Your editor now fits your hands. Let's supercharge it with the right extensions.