Cursor
AI-first code editor built on VS Code with advanced AI integration.
Official WebsiteFeatures
Installation
brew install --cask cursorWhy Use Cursor?
Cursor is an AI-first code editor built on Visual Studio Code. It provides advanced AI features including intelligent code completion, codebase understanding, and Agent Mode for autonomous development.
AI Tab Completion
Predictive code completion that understands your codebase context. Accept suggestions with Tab.
Multi-Model Support
Use GPT-4, Claude, and other models. Switch between models based on task requirements.
Codebase Learning
Index and understand your entire codebase. AI references relevant code automatically.
VS Code Compatible
Full VS Code extension support. Import settings, keybindings, and extensions seamlessly.
Installation
# macOS (Homebrew)
brew install --cask cursor
# macOS / Windows / Linux (from official website)
# https://cursor.com/
# After installation, import VS Code settings:
# Cursor > Settings > Import VS Code SettingsBasic Operations
# Open a file
cursor filename.txt
# Open directory (folder)
cursor .
cursor ~/projects/myapp
# Open in new window
cursor -n filename.txt
# Install cursor CLI (if not installed)
# Cmd+Shift+P > "Install 'cursor' command"AI Features
Inline Chat (Cmd+K)
Use Cmd+K (or Ctrl+K) to open inline AI chat. Select code and describe what you want to change.
# Examples of inline chat commands:
"Add error handling to this function"
"Refactor this to use async/await"
"Add TypeScript types"
"Write unit tests for this function"
"Optimize this code for performance"
"Add documentation comments"Chat Panel (Cmd+L)
Use Cmd+L to open the chat panel for longer conversations. The AI can reference your codebase and answer questions.
# Examples of chat panel queries:
"Explain how authentication works in this project"
"Find all API endpoints that handle user data"
"What files would I need to change to add a new feature?"
"Review this code for security issues"
"Generate a migration script for the database schema"Agent Mode (Cmd+I)
Use Cmd+I to enter Agent Mode (Composer). The AI can autonomously create, edit, and delete files to complete complex tasks.
# Examples of Agent Mode tasks:
"Create a REST API with Express and TypeScript"
"Add a new React component for user settings"
"Refactor this module to use dependency injection"
"Set up Jest testing for this project"
"Create a CI/CD pipeline configuration"Keyboard Shortcuts
AI Features
| Key (macOS) | Key (Windows/Linux) | Description |
|---|---|---|
Cmd+K | Ctrl+K | Inline AI chat (edit selected code) |
Cmd+L | Ctrl+L | Open chat panel |
Cmd+I | Ctrl+I | Open Agent Mode (Composer) |
Tab | Tab | Accept AI suggestion |
Esc | Esc | Dismiss AI suggestion |
Cmd+Shift+K | Ctrl+Shift+K | Toggle AI features |
Chat Context
| Symbol | Description |
|---|---|
@file | Reference a specific file |
@folder | Reference a folder |
@codebase | Search entire codebase |
@web | Search the web |
@docs | Reference documentation |
@git | Reference git history |
Configuration
Cursor settings can be accessed via Cmd+, or through Cursor > Settings.
{
// AI Settings
"cursor.cpp.enableTabAutocomplete": true,
"cursor.cpp.enablePartialAccepts": true,
"cursor.chat.showSuggestedFiles": true,
// Model Selection
// Available: gpt-4, gpt-4-turbo, claude-3-opus, claude-3-sonnet, etc.
"cursor.aiModel": "gpt-4",
// Codebase Indexing
"cursor.codebaseIndexing.enabled": true,
"cursor.codebaseIndexing.ignorePatterns": [
"node_modules",
".git",
"dist",
"build"
],
// Privacy
"cursor.privacy.mode": "normal", // or "privacy" to disable telemetry
// VS Code compatible settings also work
"editor.fontSize": 14,
"editor.fontFamily": "'JetBrains Mono', monospace",
"editor.formatOnSave": true
}Cursor Rules
Create a .cursorrules file in your project root to customize AI behavior.
# .cursorrules example
You are an expert TypeScript developer working on a Next.js project.
## Project Context
- This is a Next.js 14 app with App Router
- We use TypeScript strict mode
- Styling is done with Tailwind CSS
- State management uses Zustand
## Code Style
- Use functional components with hooks
- Prefer named exports over default exports
- Use descriptive variable names
- Add JSDoc comments for public functions
- Keep components small and focused
## Testing
- Write tests using Jest and React Testing Library
- Follow the Arrange-Act-Assert pattern
- Mock external dependencies
## Error Handling
- Use try-catch for async operations
- Return meaningful error messages
- Log errors with proper contextTips
- •Use
@codebasein chat to let AI search your entire project for relevant context. - •Create a
.cursorrulesfile to establish project-specific coding standards for AI. - •Select code before pressing
Cmd+Kto provide context for inline edits. - •Use Agent Mode (
Cmd+I) for multi-file changes and complex refactoring tasks. - •Import your VS Code settings and extensions when first setting up Cursor for a familiar environment.
- •Use
@docsto reference external documentation like React, Python, or API docs. - •Enable codebase indexing for better AI understanding of your project structure and patterns.