Terminal GuideTerminal Guide
cursor icon

Cursor

Text Editors
macOSLinuxWindows
TypeScript

AI-first code editor built on VS Code with advanced AI integration.

Official Website

Features

AI Tab CompletionMulti-Model SupportCodebase LearningVS Code CompatibleAgent Mode

Installation

Homebrew
brew install --cask cursor

Why 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

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 Settings

Basic Operations

CLI 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.

Inline Chat Examples
# 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.

Chat Panel Examples
# 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.

Agent Mode Examples
# 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+KCtrl+KInline AI chat (edit selected code)
Cmd+LCtrl+LOpen chat panel
Cmd+ICtrl+IOpen Agent Mode (Composer)
TabTabAccept AI suggestion
EscEscDismiss AI suggestion
Cmd+Shift+KCtrl+Shift+KToggle AI features

Chat Context

SymbolDescription
@fileReference a specific file
@folderReference a folder
@codebaseSearch entire codebase
@webSearch the web
@docsReference documentation
@gitReference git history

Configuration

Cursor settings can be accessed via Cmd+, or through Cursor > Settings.

settings.json
{
  // 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
# .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 context

Tips

  • Use @codebase in chat to let AI search your entire project for relevant context.
  • Create a .cursorrules file to establish project-specific coding standards for AI.
  • Select code before pressing Cmd+K to 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 @docs to reference external documentation like React, Python, or API docs.
  • Enable codebase indexing for better AI understanding of your project structure and patterns.

Explore More