📝Code Editors & VS Code Setup
Where to write code — install and configure VS Code step by step
What Is a Code Editor?
A code editor is a specialized text application designed for writing and editing programming code. Unlike a word processor such as Microsoft Word or Google Docs, a code editor does not add hidden formatting, fonts, or layout metadata to your files. It works with plain text only.
Why You Cannot Use a Word Processor
When you type in Microsoft Word and save the file, Word stores much more than just the characters you typed. It embeds font information, paragraph styles, page margins, XML metadata, and binary data. If you tried to save a Python script as a .docx file and then run it, the interpreter would choke on all that invisible formatting.
Code editors save files as pure plain text — exactly the bytes you see on the screen, nothing more. That is what compilers, interpreters, and browsers expect.
Key Differences at a Glance
| Feature | Word Processor | Code Editor |
|---|---|---|
| File format | .docx, .odt (binary/XML) | .py, .js, .html (plain text) |
| Hidden formatting | Yes | No |
| Syntax highlighting | No | Yes |
| Auto-completion for code | No | Yes |
| Line numbers | Optional | Built-in |
| Built-in terminal | No | Often yes |
Popular Code Editors
There are many code editors available. Here are the most common ones you will encounter:
1. Visual Studio Code (VS Code)
- Developer: Microsoft (open-source)
- Price: Free
- Platforms: Windows, macOS, Linux
- Why popular: Huge extension marketplace, built-in terminal, Git integration, IntelliSense auto-completion, massive community.
2. Sublime Text
- Price: Free to evaluate, license costs around $99
- Strength: Extremely fast and lightweight
- Weakness: Fewer built-in features — you need plugins for most things
3. Vim / Neovim
- Price: Free
- Strength: Runs in the terminal, extremely powerful once mastered
- Weakness: Very steep learning curve — the editor is entirely keyboard-driven
4. Notepad++
- Price: Free (Windows only)
- Strength: Simple and lightweight
- Weakness: No built-in terminal, limited extension ecosystem
5. JetBrains IDEs (PyCharm, WebStorm, IntelliJ)
- Price: Free community editions, paid professional editions
- Strength: Deep language-specific intelligence
- Weakness: Heavy on system resources, can be overwhelming for beginners
Why We Recommend VS Code
For beginners, Visual Studio Code is the best starting point:
- Free and open-source — no license fees, no trial periods.
- Cross-platform — identical experience on Windows, macOS, and Linux.
- Built-in terminal — run your code without leaving the editor.
- Extension marketplace — thousands of extensions for every language and workflow.
- Massive community — easy to find tutorials, answers, and help online.
- Git integration — version control built right into the sidebar.
- IntelliSense — smart auto-completion, parameter hints, and quick info.
- Lightweight — starts fast compared to full IDEs like PyCharm.
VS Code is used by over 70% of professional developers according to the Stack Overflow Developer Survey. Learning it now gives you a skill you will use throughout your career.
Installing VS Code
On macOS
- Open your browser and go to https://code.visualstudio.com.
- Click the large Download for Mac button.
- A
.zipfile will download. Open your Downloads folder. - Double-click the
.zipfile to extract it. - Drag Visual Studio Code.app into your Applications folder.
- Open Launchpad or Spotlight (Cmd + Space) and type "Visual Studio Code".
- Click to launch. On first launch macOS may ask you to confirm — click Open.
Optional — Add to PATH:
Open VS Code, press Cmd + Shift + P to open the Command Palette, type "Shell Command: Install 'code' command in PATH", and press Enter. Now you can open any folder from Terminal by typing:
code /path/to/your/projectOn Windows
- Go to https://code.visualstudio.com.
- Click Download for Windows.
- Run the downloaded
.exeinstaller. - Accept the license agreement.
- Important: Check the box that says "Add to PATH" during installation.
- Check "Register Code as an editor for supported file types".
- Click Install and wait for it to finish.
- Click Finish to launch VS Code.
After installation you can open any folder from Command Prompt or PowerShell:
code C:\Users\YourName\projects\my-appOn Linux (Ubuntu / Debian)
# Download the .deb package
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
# Update and install
sudo apt update
sudo apt install code -yOr simply download the .deb file from the website and run:
sudo dpkg -i code_*.debFirst Look at the VS Code Interface
When you open VS Code for the first time, here is what you see:
The Activity Bar (Left Edge)
A vertical strip of icons on the far left. Each icon opens a different panel:
- Explorer (files icon) — browse your project files and folders
- Search (magnifying glass) — find and replace across your project
- Source Control (branch icon) — Git integration
- Run and Debug (play icon) — run and debug your code
- Extensions (squares icon) — install and manage extensions
The Side Bar
When you click an Activity Bar icon, the Side Bar expands to show that panel's content. For example, clicking Explorer shows your file tree.
The Editor Area (Center)
This is where you write code. You can open multiple files in tabs, split the editor into side-by-side panes, and even preview Markdown files.
The Panel (Bottom)
The bottom panel contains:
- Terminal — a full command-line terminal
- Output — logs from extensions and tasks
- Problems — errors and warnings in your code
- Debug Console — interactive debugging output
The Status Bar (Very Bottom)
A thin bar showing your current branch, line/column number, file encoding, language mode, and more.
Creating Your First File
- Open VS Code.
- Click File > New File (or press
Ctrl+N/Cmd+N). - Type the following code:
# my_first_file.py
print("Hello from VS Code!")- Save the file: press
Ctrl+S/Cmd+S. - In the save dialog, name it
my_first_file.pyand choose a location. - Notice that VS Code now applies syntax highlighting — the comment is a different color from the function name and the string.
Running the File
Open the built-in terminal (Ctrl+\`` or Cmd+``) and type:
python my_first_file.pyYou should see:
Hello from VS Code!
Essential Extensions to Install
Extensions add superpowers to VS Code. Here are the must-haves for beginners:
How to Install an Extension
- Click the Extensions icon in the Activity Bar (or press
Ctrl+Shift+X/Cmd+Shift+X). - Type the extension name in the search box.
- Click Install.
Recommended Extensions
| Extension | Purpose |
|---|---|
| Python (by Microsoft) | Python language support, IntelliSense, linting, debugging |
| Prettier | Automatic code formatting for HTML, CSS, JavaScript, and more |
| ESLint | JavaScript/TypeScript linting and error detection |
| Live Server | Launch a local development server for HTML files with live reload |
| GitLens | Enhanced Git history and blame annotations |
| Material Icon Theme | Beautiful file/folder icons in the Explorer |
| One Dark Pro or Dracula Official | Popular dark themes |
| Code Runner | Run code snippets in many languages with one click |
| Bracket Pair Colorizer | Color-match opening and closing brackets |
| Path Intellisense | Auto-complete file paths as you type |
Changing the Theme
A good theme reduces eye strain and makes code easier to read.
- Press
Ctrl+K Ctrl+T(orCmd+K Cmd+Ton Mac). - A dropdown appears with all installed themes.
- Use the arrow keys to preview each theme in real time.
- Press Enter to select.
Popular themes to try:
- One Dark Pro — the beloved Atom editor theme
- Dracula Official — soft purple dark theme
- GitHub Theme — light or dark, matches GitHub's look
- Night Owl — designed for night coding with reduced blue light
- Monokai Pro — a classic developer favorite
Opening a Folder (Workspace)
Instead of opening individual files, you should open an entire folder as your workspace. This lets VS Code understand your project structure.
From the Menu
- Click File > Open Folder (or
Ctrl+K Ctrl+O/Cmd+K Cmd+O). - Navigate to your project folder and click Open.
From the Terminal
# Create a project folder and open it
mkdir ~/my-project
code ~/my-projectOnce a folder is open, the Explorer panel shows all files and subfolders. You can create, rename, delete, and move files directly in the Explorer.
Using the Built-in Terminal
One of the most powerful features of VS Code is the integrated terminal.
Opening the Terminal
- Press
Ctrl+\`` (orCmd+`` on Mac) - Or click Terminal > New Terminal from the menu
Key Terminal Features
- The terminal opens inside your project folder automatically.
- You can have multiple terminals — click the
+icon to add more. - You can split terminals side by side.
- You can switch between terminals using the dropdown.
- The terminal supports your default shell (bash, zsh, PowerShell, etc.).
Example Workflow
# In the VS Code terminal
mkdir src
touch src/app.py
python src/app.pyYou never need to leave VS Code. Write code in the editor, run it in the terminal, see errors in the Problems panel — all in one window.
Essential Keyboard Shortcuts
Learning keyboard shortcuts makes you dramatically faster. Here are the most important ones:
General
| Action | Windows/Linux | macOS |
|---|---|---|
| Save file | Ctrl+S | Cmd+S |
| Open file | Ctrl+O | Cmd+O |
| Close file | Ctrl+W | Cmd+W |
| Undo | Ctrl+Z | Cmd+Z |
| Redo | Ctrl+Y | Cmd+Shift+Z |
| Find | Ctrl+F | Cmd+F |
| Find and replace | Ctrl+H | Cmd+Option+F |
Navigation
| Action | Windows/Linux | macOS |
|---|---|---|
| Quick file open | Ctrl+P | Cmd+P |
| Command Palette | Ctrl+Shift+P | Cmd+Shift+P |
| Go to line | Ctrl+G | Cmd+G |
| Toggle terminal | `Ctrl+`` | `Cmd+`` |
| Toggle sidebar | Ctrl+B | Cmd+B |
Editing
| Action | Windows/Linux | macOS |
|---|---|---|
| Move line up/down | Alt+Up/Down | Option+Up/Down |
| Copy line down | Shift+Alt+Down | Shift+Option+Down |
| Delete line | Ctrl+Shift+K | Cmd+Shift+K |
| Comment line | Ctrl+/ | Cmd+/ |
| Multi-cursor | Alt+Click | Option+Click |
| Select all occurrences | Ctrl+Shift+L | Cmd+Shift+L |
Tip: Print or bookmark this list. You do not need to memorize everything at once — learn one or two new shortcuts each week.
Creating a Project Folder Structure
Professional projects follow organized folder structures. Here is a common pattern:
my-project/
├── src/
│ ├── main.py
│ ├── utils.py
│ └── config.py
├── tests/
│ ├── test_main.py
│ └── test_utils.py
├── docs/
│ └── README.md
├── .gitignore
└── requirements.txt
Creating This Structure in VS Code
Method 1 — Using the Explorer panel:
- Open your project folder in VS Code.
- Hover over the Explorer panel and click the New Folder icon.
- Create
src,tests, anddocsfolders. - Click the New File icon inside each folder to create the files.
Method 2 — Using the terminal:
# Create the folder structure
mkdir -p my-project/{src,tests,docs}
# Create the files
touch my-project/src/main.py
touch my-project/src/utils.py
touch my-project/src/config.py
touch my-project/tests/test_main.py
touch my-project/tests/test_utils.py
touch my-project/docs/README.md
touch my-project/.gitignore
touch my-project/requirements.txtWhat Each Folder Is For
| Folder/File | Purpose |
|---|---|
src/ | Your main source code |
tests/ | Automated tests for your code |
docs/ | Documentation files |
.gitignore | Tells Git which files to ignore (e.g., __pycache__) |
requirements.txt | Lists Python package dependencies |
Summary
- A code editor works with plain text — never use a word processor for code.
- VS Code is the most popular free code editor with a rich extension ecosystem.
- Install VS Code from code.visualstudio.com for your operating system.
- The interface has five key areas: Activity Bar, Side Bar, Editor, Panel, and Status Bar.
- Install essential extensions like Python, Prettier, and a good theme.
- Always open a folder (workspace), not individual files.
- Use the built-in terminal to run your code without leaving the editor.
- Learn keyboard shortcuts gradually — even a few will speed up your workflow.
- Organize your projects with a clean folder structure from the start.
You now have a professional development environment ready to go. In the next lesson, you will use this setup to write and run real programs.