π₯οΈ 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
codecommand on Windows, macOS, or Linux - Customize theme, icons, and a programming font with ligatures
- Edit
settings.jsondirectly 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:
- Open the Command Palette with
Cmd+Shift+P. - Type "shell command".
- 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
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.
| Action | Windows / Linux | macOS |
|---|---|---|
| Command Palette | Ctrl+Shift+P | Cmd+Shift+P |
| Quick Open file | Ctrl+P | Cmd+P |
| Toggle terminal | Ctrl+` | Cmd+` |
| Toggle sidebar | Ctrl+B | Cmd+B |
| Add next occurrence (multi-cursor) | Ctrl+D | Cmd+D |
| Move line up/down | Alt+β / β | Option+β / β |
| Copy line up/down | Shift+Alt+β / β | Shift+Option+β / β |
| Comment line | Ctrl+/ | Cmd+/ |
| Format document | Shift+Alt+F | Shift+Option+F |
| Go to definition | F12 | F12 |
π‘ 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
- Install a programming font (JetBrains Mono or Fira Code) on your OS.
- Open User Settings (JSON) from the Command Palette and paste the settings block from this lesson, adjusting the font to what you installed.
- Install the Prettier extension so
formatOnSavehas a formatter to call. - Save a messy file and watch it auto-format.
Part B β drill the shortcuts
- Create
index.html, type!and press Tab to scaffold it with Emmet. - Add
ul>li*5+ Tab to generate a list. - Use
Ctrl+Dto select a repeated word and rename all occurrences at once. - Open the integrated terminal with
Ctrl+`and runnode -v. - 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
codecommand socode .opens any project. - Tune theme, icons, and a ligature font for readable, comfortable coding.
settings.jsonis the real source of truth;formatOnSaveis 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.