AI logoAIv2BEGINNER

Cursor

Cursor AI cheat sheet with keyboard shortcuts, AI-powered code generation, chat commands, and editor configuration tips with examples.

12 min read
aiideeditorproductivitycoding

Sign in to mark items as known and track your progress.

Sign in

Essential Shortcuts

Core keyboard shortcuts for everyday use

AI Chat & Panel

Access AI features quickly

📄 Codebash
# 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
📄 Examplebash
// 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 changes
💡 Ctrl+I is your main entry to AI features
⚡ Use Ctrl+L with selected code for context
🔍 Ctrl+Enter accepts all suggested changes
📌 Esc unfocuses the input field
chataishortcuts

Inline Edit (Ctrl+K)

Edit code directly with AI assistance

📄 Codebash
# 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
📄 Examplebash
// 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 edits
💡 Ctrl+K is fastest for quick edits
⚡ Alt+Enter for instant code explanations
🔍 Full file edits for comprehensive changes
📌 Tab jumps between multiple edit locations
inlineeditrefactor

Tab Completion

AI-powered code completions

📄 Codebash
# 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
📄 Examplebash
// 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 location
💡 Tab learns from your coding patterns
⚡ Multi-line suggestions available
🔍 Auto-imports dependencies
📌 Predictive jumps across files
tabcompletionautocomplete

Context Management

Control what AI sees and references

Adding Context to Chat

Include relevant code and files

📄 Codebash
# 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
📄 Examplebash
// 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?
💡 @ symbol references specific context
⚡ Ctrl+Enter searches entire codebase
🔍 Clipboard auto-formats as context
📌 Multiple files can be referenced at once
contextreferencesearch

Rules Configuration

Set persistent coding rules and patterns

📄 Codeyaml
# 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
📄 Exampleyaml
// 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 components
💡 Rules persist across all conversations
⚡ Project rules override user rules
🔍 Globs target specific file patterns
📌 AGENTS.md for simple rule lists
rulesconfigurationcontext

Memories

AI learns from your conversations

📄 Codebash
# 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"
📄 Examplebash
// 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]
💡 Memories improve AI responses over time
⚡ Project-specific learning
🔍 Review memories in settings
📌 Explicit approval before saving
memorieslearningcontext

AI Models & Configuration

Configure AI providers and models

Model Selection

Choose and switch between AI models

📄 Codebash
# 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
📄 Examplebash
// 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 coding
💡 Different models excel at different tasks
⚡ Auto mode intelligently selects models
🔍 200k token context (~15,000 lines)
📌 Privacy mode for sensitive code
modelsaiconfiguration

API Key Configuration

Use your own API keys

📄 Codebash
# 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
📄 Examplebash
// 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 connected
💡 Use custom keys for unlimited usage
⚡ Azure/AWS for enterprise compliance
🔍 Keys verified before activation
📌 Reasoning models require Cursor subscription
apikeysconfiguration

Agent Mode

Autonomous AI coding assistant

Using Agent Mode

Let AI complete complex tasks autonomously

📄 Codebash
# 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
📄 Examplebash
// 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 implemented
💡 Agent works autonomously
⚡ Creates checkpoints for rollback
🔍 Reviews changes before applying
📌 Can execute terminal commands
agentautonomousai

Background Agent

Continuous code monitoring and improvement

📄 Codebash
# 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
📄 Examplebash
// 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 smells
💡 Runs continuously in background
⚡ Proactive bug detection
🔍 No manual triggering needed
📌 VM-based for isolation
backgroundagentmonitoring

Advanced Features

Power user features and integrations

Command Palette

Access all commands quickly

📄 Codebash
# 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
📄 Examplebash
// 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 suggestions
💡 Access any feature via palette
⚡ Searchable command list
🔍 Shows keyboard shortcuts
📌 Custom commands supported
commandspaletteshortcuts

Chat Modes

Different conversation modes for specific tasks

📄 Codejson
# 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
📄 Examplejson
// 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"
💡 Modes tailor AI behavior
⚡ Create project-specific modes
🔍 Temperature controls creativity
📌 Include specific file patterns
modescustomchat

Integrations

Connect with external tools

📄 Codebash
# 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
📄 Examplebash
// 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 channel
💡 Seamless tool integration
⚡ Automated workflows
🔍 Bugbot for automatic reviews
📌 Custom URL protocol support
integrationsgithubslack

Tips & Best Practices

Get the most out of Cursor

Effective Context Management

Optimize AI understanding

📄 Codebash
# 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
📄 Examplebash
// 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"
💡 Specific context = better results
⚡ Rules ensure consistency
🔍 Memories improve over time
📌 New chats for new tasks
tipscontextbest-practices

Performance Optimization

Keep Cursor running smoothly

📄 Codebash
# 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
📄 Examplebash
// EXAMPLE: Exclusion patterns
{
  "tab.exclusions": [
    "*.min.js",
    "*.bundle.js", 
    "node_modules/**",
    "dist/**",
    "*.generated.ts"
  ]
}
💡 Exclude generated/minified files
⚡ Privacy mode for sensitive data
🔍 Clear cache fixes most issues
📌 Snooze Tab during debugging
performanceoptimizationtips

Troubleshooting Common Issues

Quick fixes for common problems

📄 Codebash
# 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
📄 Examplebash
// 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
💡 Most issues solved by cache clear
⚡ Check settings for conflicts
🔍 Developer tools for debugging
📌 Report persistent issues
troubleshootingdebugfixes