Cursor AI: Complete Setup and Practical Coding Guide
In this article
- What Cursor Is (and What It Isn't)
- Installation
- Keyboard Shortcut Reference
- Feature 1: Inline Code Generation (Cmd+K)
- Feature 2: Tab Autocomplete
- Feature 3: Chat Panel (Cmd+L)
- Feature 4: @ Context Mentions
- Feature 5: Custom AI Rules
- Feature 6: Custom AI Models
- Cursor vs GitHub Copilot
- Tips for Production Use
- What to Read Next
What Cursor Is (and What It Isn't)
Cursor is a code editor built as a fork of VS Code. It inherits the full VS Code extension marketplace, keyboard shortcuts, settings system, and file handling — then layers in deep AI integration through a built-in inference client that can call Claude Sonnet, GPT-4.1, and other models.
The key difference from GitHub Copilot is architecture: Copilot is a plugin you add to an existing editor. Cursor is the editor. This lets it index your entire codebase into context, observe your edits across files, and predict multi-line changes with more coherence than inline completions alone can achieve.
Installation
Download from cursor.com — installers are available for macOS, Windows, and Linux.
macOS/Windows: Run the installer directly.
Linux: The download is an .AppImage file. Make it executable and run it:
chmod a+x cursor_2.6.14_x86_64.AppImage
./cursor_2.6.14_x86_64.AppImage
Replace cursor_2.6.14_x86_64 with the actual downloaded filename (versions update frequently; the naming format may differ between architectures, e.g., cursor_2.4.46_arm64.deb on ARM Linux).
On first launch, Cursor prompts for:
- Keyboard layout — defaults to VS Code shortcuts; keep this unless you're migrating from a different editor
- AI language — language to use when interacting with the AI assistant
- Codebase-wide context — enabling this indexes your project for codebase-level questions (recommended for any project with multiple files)
Keyboard Shortcut Reference
| Shortcut (macOS) | Shortcut (Win/Linux) | Action |
|---|---|---|
| Cmd+K | Ctrl+K | Open inline code generator / interact with selected code |
| Cmd+L | Ctrl+L | Open the chat panel |
| Tab | Tab | Accept AI autocomplete suggestion |
| Esc | Esc | Dismiss autocomplete suggestion |
| Cmd+Shift+L | Ctrl+Shift+L | Add selected code to chat context |
Feature 1: Inline Code Generation (Cmd+K)
Cmd+K with no selection opens a floating prompt bar. Type a natural language instruction and press Enter to generate:
Add input validation to this function that raises ValueError for negative inputs
Cursor generates the code inline as a diff. Green lines are additions, red lines are removals. Accept with the Accept button, reject with Reject, or modify the prompt to refine.
Interacting with existing code: Select a function or block first, then press Cmd+K. Now Cursor can refactor, explain, add type hints, or rewrite it based on your prompt. The selection becomes part of the prompt context automatically.
Quick questions: With code selected and Cmd+K open, click the Quick Question button instead of Submit Edit to ask a question without making changes (e.g., "Why does this use O(n²) complexity?").
Feature 2: Tab Autocomplete
While typing, Cursor continuously generates multi-line completion suggestions. Press Tab to accept. The suggestions are contextually aware — if you just defined a User dataclass and start writing a function, Cursor predicts the parameter types and return signature.
This also works with plain English. Write a comment describing what you need:
# iterate over all pairs in a list and check if their sum equals target
Cursor suggests the corresponding double-loop implementation. Press Tab to insert.
Unlike simple token completion, Cursor predicts based on recent edits — it knows what you changed 30 seconds ago and uses that as additional context.
Feature 3: Chat Panel (Cmd+L)
The chat panel is more powerful than inline generation for multi-step tasks:
- Codebase queries — ask questions about the project without selecting code first
- Multi-file changes — generate edits that span multiple files and apply them all at once
- Instant Apply — code blocks in the chat have an "Apply" button that diffs the change directly into the active file
- Model selection — switch between Claude Sonnet, GPT-4.1, and other models mid-conversation
Example codebase query without any selection:
Find all places in this project where user input is passed directly to SQL queries
without parameterization
Cursor scans the indexed codebase and returns matches with file paths.
Feature 4: @ Context Mentions
The @ key in the chat panel opens a context menu with powerful options:
| Mention | What It Adds |
|---|---|
@file | Add a specific file to context |
@folder | Add all files in a directory |
@codebase | Enable full indexed codebase search |
@web | Fetch live web results (bypasses training cutoff) |
@docs | Reference a documentation URL you've added |
@git | Include a GitHub repository in context |
@web example: Cursor's training data has a cutoff. Asking about a library released recently will produce outdated or hallucinated answers. Use @web to pull live documentation:
@web How do I configure streaming responses in the latest Anthropic Python SDK?
@docs for private libraries: Team-internal or lesser-known libraries won't be in Cursor's training data. Add their docs:
- In the chat, type
@→ select Docs → enter the documentation URL - Name the reference (e.g., "MyInternalLib")
- Reference it in future prompts with
@MyInternalLib
Documentation references are managed in Settings → Features → Docs.
Feature 5: Custom AI Rules
Cursor lets you define persistent rules that modify the AI's behavior across all requests — no need to repeat the same instructions in every prompt.
Access via Settings → General → Rules for AI. Examples:
Always use type hints in Python function definitions.
Never use `any` in TypeScript — use explicit types or unknown.
All generated SQL must use parameterized queries.
When generating React components, use functional components with hooks.
Rules are applied globally to all inline and chat interactions.
Feature 6: Custom AI Models
Settings → Models shows the available models and lets you add others. Cursor supports any OpenAI-compatible endpoint — useful if you want to route inference through a self-hosted vLLM instance or an Ollama server:
- Add a new model
- Set the base URL to
http://localhost:11434/v1(for Ollama) - Enter any placeholder API key (Ollama ignores it)
- Set the model name to whatever you have running (e.g.,
qwen3:8b)
This makes Cursor's chat and autocomplete call your local model instead of Anthropic or OpenAI APIs — useful for codebases where you can't send code externally.
Cursor vs GitHub Copilot
| Dimension | Cursor | GitHub Copilot |
|---|---|---|
| Architecture | Standalone VS Code fork | Plugin for VS Code, JetBrains, Neovim, etc. |
| Codebase indexing | Full project index, semantic search | Limited; mainly active file context |
| Multi-file edits | Yes — chat can propose cross-file changes | Limited; mostly single-file suggestions |
| Custom models | Yes — add any OpenAI-compatible endpoint | No — Copilot models only |
| Custom rules | Yes — global rules for AI behavior | Limited via Copilot instructions |
| Inline autocomplete | Multi-line, edit-aware | Multi-line, strong at next-line prediction |
| Editor flexibility | Only VS Code | VS Code, JetBrains, Vim, Neovim, and others |
| Pricing | Free tier (limited); Pro $20/month | Free tier; Pro $10/month; Business $19/month |
Choose Cursor if: You do most of your work in VS Code, want deep codebase context, and care about multi-file refactoring.
Choose Copilot if: You use multiple editors (JetBrains for Java, VS Code for scripts), work in a GitHub-heavy enterprise setup, or need the lowest friction onboarding.
Tips for Production Use
Keep sensitive code out of chat context: The @codebase and @git options send your code to Anthropic or OpenAI servers. For proprietary repositories, either route through your own model (local Ollama or a private vLLM deployment) or avoid using @codebase on sensitive files.
Use custom rules for consistency: If you're onboarding a new team member, Cursor's rules file acts as a lightweight coding standards enforcer. Document your patterns once and Cursor applies them automatically.
Combine Cmd+K and Cmd+L: Inline generation (Cmd+K) is faster for surgical edits. Chat (Cmd+L) is better for reasoning through an approach before writing any code. Use both.
What to Read Next
- Run Claude Code Locally with Ollama — terminal-based AI coding agent as an alternative to Cursor's chat interface
- Run Claude Code for Free with OpenRouter — reduce API costs when using Cursor with Claude models
- How to Run Local LLMs Securely with Ollama — set up a local Ollama server to back Cursor's custom model feature
Related Guides
The Complete Developer Guide to Running LLMs Locally: From Ollama to Production
Everything you need to run LLMs on your own hardware in 2026: VRAM sizing, model formats, an 8-tool comparison table, a full local RAG pipeline, and Docker production deployment with GPU passthrough and Nginx auth.
Event-Driven Architecture for Agentic AI: The Architect's Guide
A comprehensive architectural guide to designing resilient, real-time agentic AI systems using event-driven architecture — covering loose coupling, fault isolation, reference architecture, and governance patterns.
How to Run DeepSeek R1 Locally with Ollama: Full Setup Guide
Install DeepSeek R1 locally using Ollama in under 5 minutes. Covers model variant selection from 1.5B to 671B, visible chain-of-thought reasoning, REST API usage, Python integration, and building a simple RAG application.