Cursor
Cursor AI cheat sheet with keyboard shortcuts, AI-powered code generation, chat commands, and editor configuration tips with examples.
Other AI Sheets
Sign in to mark items as known and track your progress.
Sign inEssential Shortcuts
Core keyboard shortcuts for everyday use
AI Chat & Panel
Access AI features quickly
# Open AI Chat
Ctrl+I # Toggle Chat panel
Ctrl+L # Add selection to new chat
# Chat controls
Enter # Send message (Nudge mode)
Ctrl+Enter # Queue/Force send message
Ctrl+Shift+BackSpace # Cancel generation
# Navigation
Ctrl+N # New chat
Ctrl+T # New chat tab
Ctrl+[ # Previous chat
Ctrl+] # Next chat
Ctrl+W # Close chat// EXAMPLE: Working with AI Chat
1. Select problematic code
2. Press Ctrl+L to add to chat
3. Type: "Fix the type errors in this function"
4. Press Enter to send
5. Ctrl+Enter to accept all changesInline Edit (Ctrl+K)
Edit code directly with AI assistance
# Inline editing
Ctrl+K # Open inline edit input
Ctrl+Shift+K # Toggle input focus/Add selection
# Quick actions
Alt+Enter # Ask quick question about code
Ctrl+Shift+Enter # Perform full file edits
# Controls
Enter # Submit edit request
Ctrl+Shift+BackSpace # Cancel edit
Tab # Jump to next edit location// EXAMPLE: Refactoring with Inline Edit
1. Select function to refactor
2. Press Ctrl+K
3. Type: "Convert to async/await"
4. Press Enter
5. Review changes inline
6. Tab to jump between editsTab Completion
AI-powered code completions
# Accept suggestions
Tab # Accept full suggestion
Ctrl+→ # Accept word-by-word
Esc # Reject suggestion
# After edits
Tab # Jump to next predicted location
# Configuration
Cursor Settings > Features > Tab
- Enable/disable in comments
- Configure auto-import
- Set file extension exclusions// EXAMPLE: Smart Tab Completion
// Start typing a function...
function calc
// Tab accepts: function calculateTotal(items) {
// return items.reduce((sum, item) => sum + item.price, 0)
// }
// Tab again jumps to next likely edit locationContext Management
Control what AI sees and references
Adding Context to Chat
Include relevant code and files
# Selection context
Ctrl+Shift+L # Add selected code to chat
Ctrl+L # Add selection to new chat
# Clipboard context
Ctrl+V # Add clipboard as context (auto-detect)
Ctrl+Shift+V # Add clipboard to input box
# Reference operators
@ # Reference specific items
# # Reference files
/ # Use shortcut commands
# Codebase search
Ctrl+Enter # Search entire codebase in chat// EXAMPLE: Multi-file context
> @file1.ts @file2.ts How do these interact?
// EXAMPLE: Codebase search
> Find all API endpoints [Ctrl+Enter]
// EXAMPLE: Reference specific function
> @calculateTotal Why does this return NaN?Rules Configuration
Set persistent coding rules and patterns
# Rule file locations
.cursor/rules/ # Project-specific rules
AGENTS.md # Simple project rules
User Settings > Rules # Global user rules
# Rule file format (.cursor/rules/*.mdc)
---
description: API Standards
globs: ["**/*.api.ts"]
alwaysApply: false
---
- Use REST conventions
- Include error handling
- Add JSDoc comments
# Legacy: root .cursorrules still loads but is
# ignored in Agent mode - migrate to .cursor/rules/*.mdc
# Rule behaviors
Always # Always included in context
Auto Attached # Included with matching files
Agent Requested # AI decides inclusion
Manual # Only when mentioned// EXAMPLE: Project rules in .cursor/rules/style.md
---
description: Code style guide
alwaysApply: true
---
- Use TypeScript strict mode
- Prefer const over let
- Use async/await over callbacks
- Add error boundaries to componentsMemories
AI learns from your conversations
# Memories are automatically generated
- Created from chat conversations
- Project-scoped context
- User approval required
# Management
Cursor Settings > Rules > Memories
- View all memories
- Edit or delete memories
- Control auto-generation
# Memory format
"Always use error-first callbacks in Node.js"
"Prefer named exports over default exports"
"User prefers functional components"// EXAMPLE: Memory generation
You: "Always use Zod for validation"
Cursor: "I'll remember to use Zod for validation"
[Memory saved for project]
// Future conversations:
You: "Add validation to this API"
Cursor: [Automatically uses Zod based on memory]AI Models & Configuration
Configure AI providers and models
Model Selection
Choose and switch between AI models
# Quick model switching
Ctrl+/ # Loop between models
Ctrl+Alt+/ # Model toggle in chat
# Available providers
- Cursor models (default)
- OpenAI (GPT-4, GPT-3.5)
- Anthropic (Claude 3.5, Claude 3)
- Google (Gemini)
- DeepSeek
- xAI
- Azure OpenAI
- AWS Bedrock
# Special modes
Auto Mode # Automatically selects best model
Max Mode # Extended context window
Privacy Mode # No data storage// EXAMPLE: Switching models for different tasks
Ctrl+/ → GPT-4 for complex logic
Ctrl+/ → Claude for refactoring
Ctrl+/ → Cursor-small for quick edits
// EXAMPLE: Auto mode selection
Auto Mode → Uses o1 for complex algorithms
Auto Mode → Uses GPT-4 for general codingAPI Key Configuration
Use your own API keys
# Configure in Cursor Settings > Models
# Supported custom keys:
- OpenAI API key
- Anthropic API key
- Google AI API key
- Azure OpenAI endpoint
- AWS Bedrock credentials
# Configuration steps:
1. Open Cursor Settings (Ctrl+Shift+J)
2. Navigate to Models
3. Enter API key
4. Verify connection
# Notes:
- Keys encrypted, not stored locally
- Custom keys don't support o1/o1-mini
- Usage billed to your account// EXAMPLE: Azure OpenAI setup
{
"azure": {
"endpoint": "https://myorg.openai.azure.com",
"apiKey": "your-api-key",
"deployment": "gpt-4"
}
}
// EXAMPLE: Using custom OpenAI key
Settings > Models > OpenAI
API Key: sk-...
✓ Verified and connectedAgent Mode
Autonomous AI coding assistant
Using Agent Mode
Let AI complete complex tasks autonomously
# Access Agent Mode
Ctrl+I # Open chat
Select "Agent" mode from dropdown
# Agent capabilities:
- Semantic codebase search
- Multi-file editing
- Terminal command execution
- Automatic change tracking
- Creates checkpoints
# Best for:
- Feature implementation
- Bug fixes across files
- Refactoring projects
- Setting up configurations// EXAMPLE: Agent implementing feature
You: "Add user authentication with JWT"
Agent:
1. Searching for existing auth code...
2. Creating auth middleware...
3. Setting up JWT utilities...
4. Adding login/logout endpoints...
5. Updating user model...
6. Running tests...
✓ Authentication system implementedBackground Agent
Continuous code monitoring and improvement
# Enable Background Agent
Ctrl+E # Open Background Agent panel
# Features:
- Creates remote VM
- Explores project automatically
- Detects bugs proactively
- Proposes fixes
- Runs independently
# Configuration:
Settings > Features > Background Agent
- Enable/disable
- Set inspection frequency
- Configure notification preferences// EXAMPLE: Background Agent findings
[Background Agent Notification]
"Found potential null reference in auth.service.ts:45"
→ View Issue
→ Apply Fix
→ Dismiss
// Automatically discovers:
- Type errors
- Security vulnerabilities
- Performance issues
- Code smellsAdvanced Features
Power user features and integrations
Command Palette
Access all commands quickly
# Open command palette
Ctrl+Shift+P # Command palette
# Useful commands:
"Cursor: Settings" # Open Cursor settings
"Cursor: Export Chat" # Export to markdown
"Cursor: Clear Cache" # Clear AI cache
"Cursor: Toggle Privacy Mode"
"Cursor: Show Rules"
"Cursor: Snooze Tab" # Temporarily disable
# Custom commands:
Add to keybindings.json for shortcuts// EXAMPLE: Common command workflows
Ctrl+Shift+P → "Export Chat"
→ Saves conversation as markdown
Ctrl+Shift+P → "Toggle Privacy"
→ Enables privacy mode for sensitive code
Ctrl+Shift+P → "Clear Cache"
→ Fixes stuck suggestionsChat Modes
Different conversation modes for specific tasks
# Available modes (dropdown in chat):
Agent Mode # Autonomous task completion
Ask Mode # Question-answering only
Custom Modes # User-defined behaviors
# Creating custom modes:
Settings > Features > Custom Modes
{
"name": "Code Review",
"prompt": "Review code for bugs, security issues, and improvements",
"temperature": 0.3
}
# Mode shortcuts:
Ctrl+. # Quick mode menu// EXAMPLE: Custom Security Mode
{
"name": "Security Audit",
"prompt": "Check for vulnerabilities, validate inputs, ensure encryption",
"includeFiles": ["*.auth.*", "*.api.*"],
"temperature": 0.1
}
// Usage:
Select "Security Audit" mode
> "Review this endpoint"Integrations
Connect with external tools
# Available integrations:
GitHub # PR reviews, issue tracking
Git # Version control integration
Slack # Team notifications
Linear # Task management
Bugbot # Automated code review
# Setup:
Settings > Integrations > [Service]
- Authenticate
- Configure permissions
- Set notification preferences
# Shell commands:
cursor://command/<command>
- Custom URL protocol
- Trigger from external tools// EXAMPLE: GitHub integration
1. Connect GitHub account
2. Enable PR reviews
3. Bugbot automatically reviews PRs
4. Comments appear in GitHub
// EXAMPLE: Slack notifications
"Bug found in payment.service.ts"
→ Posted to #dev-alerts channelTips & Best Practices
Get the most out of Cursor
Effective Context Management
Optimize AI understanding
# Best practices:
1. Use specific file references
@auth.service.ts not "the auth file"
2. Include error messages
Ctrl+V to paste errors as context
3. Create project rules
.cursor/rules/ for consistency
4. Review memories periodically
Settings > Rules > Memories
5. Clear context when switching tasks
Start new chat for different features// GOOD: Specific context
> @user.model.ts @auth.service.ts
> "Add password reset with email verification"
// BAD: Vague context
> "Fix the login"
// GOOD: Include errors
> [Paste TypeError stack trace]
> "Fix this type error"Performance Optimization
Keep Cursor running smoothly
# Performance tips:
1. Disable Tab for large files
Settings > Features > Tab > Exclusions
Add: "*.min.js", "*.bundle.js"
2. Use Privacy Mode for sensitive code
Prevents indexing of confidential files
3. Clear cache if suggestions lag
Ctrl+Shift+P → "Clear Cache"
4. Snooze Tab when not needed
Temporarily disable completions
5. Limit context in large projects
Use specific @ references vs entire folders// EXAMPLE: Exclusion patterns
{
"tab.exclusions": [
"*.min.js",
"*.bundle.js",
"node_modules/**",
"dist/**",
"*.generated.ts"
]
}Troubleshooting Common Issues
Quick fixes for common problems
# Common issues and solutions:
"Suggestions not appearing"
→ Check Tab is enabled
→ Clear cache (Ctrl+Shift+P)
"Chat not responding"
→ Check model selection
→ Verify API key if custom
"Wrong context included"
→ Review @ references
→ Check .cursor/rules/
"Agent stuck"
→ Ctrl+Shift+BackSpace to cancel
→ Review checkpoint history
"High memory usage"
→ Disable Background Agent
→ Limit open chat tabs// EXAMPLE: Debug process
1. Ctrl+Shift+P → "Developer: Toggle Developer Tools"
2. Check Console for errors
3. Network tab for API issues
4. Report via Settings > Help > Report Issue