How to Use Windsurf AI Editor? Complete Beginner Guide 2026
If you want to code faster with AI without switching between a chatbot and your editor, Windsurf gives you Cascade agentic coding and Supercomplete completions built right into a VS Code fork. This guide covers installation, model setup, .windsurfrules, and workflows that save real time — from zero to productive in under 30 minutes.
入门 · 30 分钟 · 2026年6月21日
TL;DR
Windsurf is Codeium's AI-native code editor — a VS Code fork rebuilt from the ground up for AI-assisted development. If you want to code faster with AI without copy-pasting between a chatbot and your editor, Windsurf gives you Cascade (an agentic AI that reads your entire project and makes changes directly) and Supercomplete (context-aware inline completions). This tutorial walks you through installation, configuration, and the workflows that actually save you time.
What You'll Learn
- Install Windsurf on macOS, Windows, or Linux in under 5 minutes
- Configure AI models — Claude Sonnet 4.5, GPT-5, and free alternatives
- Use Supercomplete for intelligent inline code suggestions
- Master Cascade for multi-file agentic coding
- Set up .windsurfrules for project-specific AI behavior
- Debug common issues and optimize your workflow
Prerequisites
- A computer running macOS (12+), Windows 10/11, or Linux (Ubuntu 20.04+)
- At least 4 GB of free RAM (8 GB recommended)
- An internet connection for AI model access
- Optional: existing VS Code settings/extensions (Windsurf can import them)
Step 1: Install Windsurf
macOS
# Option A: Download from windsurf.com
# Visit https://windsurf.com and download the .dmg installer
# Drag Windsurf to Applications folder
# Option B: Homebrew (if available)
brew install --cask windsurfWindows
Download the .exe installer from windsurf.com and run it. The installer handles everything — no manual PATH configuration needed.
Linux
# Debian/Ubuntu
wget https://windsurf.com/windsurf.deb
sudo dpkg -i windsurf.deb
# Or use the AppImage
wget https://windsurf.com/windsurf.AppImage
chmod +x windsurf.AppImage
./windsurf.AppImageFirst Launch — Import VS Code Settings
On first launch, Windsurf asks if you want to import settings, extensions, keybindings, and themes from VS Code. Select "Import from VS Code" — this gives you a familiar starting environment with all your shortcuts intact. The import is one-way and non-destructive (your VS Code setup is untouched).
Step 2: Configure AI Models
Open Windsurf, then go to Settings (Cmd+, on macOS / Ctrl+, on Windows/Linux) and search for "AI" or "Model."
Recommended Model Setup (June 2026)
| Model | Best For | Cost |
|---|---|---|
| Claude Sonnet 4.5 | Daily coding, complex refactors | Paid (Pro plan) |
| GPT-5 | Architecture planning, large context | Paid (Pro plan) |
| Cascade Base (free) | Simple edits, completions | Free tier |
How to switch models: Click the model name dropdown in the Cascade sidebar panel (bottom-left of the Cascade chat area).
Enabling Supercomplete
Supercomplete is Windsurf's inline code completion engine. It suggests entire lines or blocks based on your project context — more intelligent than standard autocomplete.
- Open Settings → Search "supercomplete"
- Toggle Enable Supercomplete to ON
- Set Supercomplete Suggestion Delay to 200ms (default is fine for most users)
- Under Supercomplete: Max Tokens, set to 256 (controls how long the suggestion can be)
Supercomplete works automatically — just start typing and pauses trigger suggestions. Press Tab to accept, Esc to dismiss.
Step 3: Use Cascade — The Agentic AI
Cascade is Windsurf's main AI agent. Unlike a chatbot where you copy-paste code, Cascade reads your entire codebase, understands project structure, and makes changes directly in your files.
Opening Cascade
Press Cmd+L (macOS) or Ctrl+L (Windows/Linux) to open the Cascade sidebar panel.
Cascade Chat vs Cascade Agent
Windsurf has two modes inside Cascade:
- Chat mode (default): Ask questions, get explanations. Writes code as suggestions you review.
- Agent mode (Ctrl+Shift+L): Autonomous editing. Cascade reads files, modifies code, creates new files, and runs terminal commands — all from a single prompt. Each change appears as a diff you can accept or reject.
Example: Build a REST API Endpoint with Cascade Agent
- Press Ctrl+Shift+L to open Cascade Agent
- Paste this prompt:
Add a GET /api/users endpoint to this Node.js Express app.
Include pagination (page and limit query params),
error handling for invalid params,
and return JSON with { users: [], total, page, limit }.-
Cascade will:
- Find your Express router file
- Read existing route patterns
- Write the new endpoint code
- Show you the diff
- Wait for you to accept or reject
-
Click Accept All (Cmd+Enter) or review each change individually
Cascade Context — How It Sees Your Code
Cascade automatically indexes your entire project on open. It sees:
- All files in the workspace (excluding .gitignore patterns)
- Open tabs as priority context
- Git history for recent changes
- Running terminal output
Pro tip: Use @filename to explicitly add files to Cascade's context if it misses something relevant.
Step 4: Write .windsurfrules for Project-Specific AI Behavior
.windsurfrules is a markdown file at your project root that tells Cascade how to behave. It's like a system prompt for your codebase.
Create .windsurfrules
Create a file named .windsurfrules in your project root:
# Project Rules for Cascade
## Tech Stack
- Next.js 15 with App Router
- TypeScript strict mode
- Tailwind CSS v4 for styling
- Prisma ORM with PostgreSQL
## Coding Standards
- Use arrow functions, not function declarations
- Always add error boundaries to new pages
- Use Zod for API validation
- File names: kebab-case for components, camelCase for utilities
## Testing
- Write tests with Vitest
- Every API route needs at least one integration test
## Never
- Do not use `any` type — use `unknown` first
- Do not add new npm dependencies without asking
- Do not modify tsconfig.json without explicit instructionSave the file. Cascade reads it automatically on every session. There is no need to reload — it picks up changes when you next invoke Cascade.
Advanced .windsurfrules with @-references
You can reference other files:
@docs/architecture.md
@docs/api-conventions.md
Always follow the patterns in the above docs when generating code.Step 5: Practical Workflows That Actually Save Time
Workflow 1: Refactor a Function Across the Codebase
- Select the function name in any file
- Press Cmd+Shift+L (Agent mode)
- Type:
Rename this function to X and update all references across the project - Cascade finds every usage and updates them all
- Review diffs → Accept All
Workflow 2: Generate Tests for an Existing Module
- Open the file you want tested
- Press Cmd+L → type:
Write comprehensive unit tests for this module using Vitest. Cover edge cases, error states, and happy paths. - Cascade reads the module, understands all exports, and writes tests
- Press Cmd+Enter to accept
Workflow 3: Debug with Terminal Integration
- Run your failing command in Windsurf's built-in terminal
- Select the error message in the terminal output
- Press Cmd+L → type:
Fix this error(Cascade gets the terminal output as context) - Cascade reads the error, the relevant files, and proposes a fix
Workflow 4: Inline Editing with Ctrl+K
- Select a block of code
- Press Ctrl+K (Cmd+K on macOS)
- Type your instruction:
Add input validation for empty strings and null values - Cascade rewrites the selected block in place
Step 6: Optimize Your Windsurf Settings
Performance Settings
| Setting | Recommended Value | Why |
|---|---|---|
| Supercomplete Delay | 200ms | Lower = faster but more API calls |
| Indexing: Exclude | node_modules, .next, dist, build | Exclude build artifacts |
| Cascade: Auto-index | ON | Always have fresh context |
UI Settings (These Make a Big Difference)
Editor: Minimap → OFF (saves sidebar space)
Editor: Inlay Hints → ON (shows inferred types)
Cascade: Show Diff Preview → ON (review before accepting)
Cascade: Auto-accept Safe Edits → OFF (always review AI changes)Critical: Keep "Auto-accept Safe Edits" OFF. Even "safe" edits like formatting can have unintended side effects in large codebases. Always review.
Windsurf vs Cursor vs VS Code Copilot (Quick Comparison)
| Feature | Windsurf | Cursor | VS Code + Copilot |
|---|---|---|---|
| Free tier | Yes (Cascade Base + Supercomplete) | Yes (limited) | Limited |
| Agentic coding | Cascade Agent | Cursor Agent | Copilot Agent Mode |
| Context engine | Deep project indexing | @-file references | Workspace awareness |
| Inline edits | Ctrl+K | Ctrl+K | Copilot Inline Chat |
| MCP support | Yes | Yes | Yes |
| Import VS Code config | Yes | Yes | Native |
| Pricing (Pro) | $15/month | $20/month | $10/month (Copilot) |
Troubleshooting
Cascade is slow to respond
- Check your internet connection — Cascade relies on cloud models
- Reduce context: close tabs you do not need in Cascade's context
- Switch to a faster model (Cascade Base is instant but less capable)
- Exclude large directories from indexing in Settings → Indexing → Exclude
Supercomplete suggestions are irrelevant
- Make sure your project has a
.windsurfrulesfile with coding conventions - Open the relevant files as tabs — Cascade prioritizes open files for context
- Check that the file type is recognized (bottom-right status bar shows language mode)
Agent changes files I did not intend
- Always use Agent mode with specific, scoped prompts
- Start prompts with file paths:
In src/utils/auth.ts, add JWT refresh logic - Review every diff before accepting — never auto-accept Agent changes
Windsurf uses too much memory
- Exclude
node_modules,.next,dist,buildfrom indexing - Close unused projects (Windsurf indexes all open workspace folders)
- Restart Windsurf daily — long sessions can accumulate memory from indexing
Import from VS Code did not bring my extensions
Windsurf uses the VS Code extension marketplace, but some extensions may not be compatible. Reinstall them manually from the Extensions panel (Cmd+Shift+X). All standard VS Code extensions work — issues typically only affect extensions that hook into VS Code-specific internal APIs.
Related Tutorials
相关推荐
How to Build an AI Agent in n8n: Complete Beginner Guide 2026
If you want to build an AI agent in n8n that fetches GitHub pull requests and sends Slack summaries — this tutorial gives you the complete step-by-step guide, from Docker self-hosting to a deployed agent with memory, tools, error handling, and production security in about 45 minutes.
How to Automate PR Code Reviews with Claude Code CLI + GitHub Actions
If you want Claude Code to automatically review every pull request before a human sees it — catching bugs, security issues, and performance problems — this tutorial gives you a complete CI pipeline in 35 minutes: prompt template, GitHub Actions workflow, and a Python script that posts line-level comments back to your PR.
赚钱视角
这个趋势怎么赚钱?
WayToClawEarn 的差异在可验证的赚钱案例,而不只是资讯。从这些复盘开始:
浏览全部案例 →相关教程
相关资讯
- Claude Code Artifacts Turns AI Coding Sessions Into Live, Shareable Web Pages
- How Do You Track Codex CLI Token Usage? Codex v0.140 Adds /usage, Claude Code Import, and Session Deletion
- Can Claude Design Replace Your Design Tool? Anthropic Adds Code Round-Trips, Figma Imports, and 2x Tokens
- Will Claude Require ID Verification? Anthropic's New Privacy Policy Explained