Cursor 101

Cursor Tutorial 3 - Master Chat (Cmd L) for Problem Solving

When should you use Chat (Cmd+L)? Learn how to leverage context for better results.

By SunnyD | Original Post

We've covered two of Cursor's core features: Tab and Command Palette (Cmd+K). Now let's master Chat (Cmd+L).

When to Use Chat

As mentioned in our Command Palette guide, Chat handles general programming questions.

Cursor Chat

Chat shines through multi-turn conversations. One answer rarely solves complex problems. Through dialogue, AI understands your needs better and guides you to the right solution.

Use Chat when you need to:

  1. Learn programming concepts, new tech, or frameworks
  2. Get code advice and best practices
  3. Debug and troubleshoot

Core Features

Like ChatGPT, Cursor's Chat offers flexible coding assistance. Ask anything.

Cursor Chat Basic Features

Two features set Cursor apart:

  1. Quick context with @ references
  2. Direct code changes with Apply

You won't find these in ChatGPT or other code editors.

Apply

Apply lets you use AI's code suggestions right away.

Cursor Chat Apply

Review changes in the diff view. Accept or reject with one click.

Cursor Chat Apply

While Chat can modify code, use these for specific changes:

  1. Command Palette (Cmd+K): Local changes
  2. Composer: Multi-file changes

Context with @

Type @ in any AI input box - Command Palette, Chat, or Composer - to reference context.

Cursor Chat Context Reference

Chat and Composer share similar @ abilities. Command Palette has limited context options since it focuses on local changes.

Context matters because of:

AI's Limits:

  • AI knows a lot, but not everything. Some tech areas remain blind spots.

Project Specifics:

  • Each project has unique patterns and needs. Without context, AI can't tailor solutions.

Smart Context Use

How do you use context well?

Think of context as AI's cheat sheet. Two rules:

  1. Pick what matters: Include relevant info, skip the rest
  2. Find the sweet spot: Give enough but not too much. Too little leaves AI confused. Too much creates hallucinations.

Give AI just what it needs. No more, no less.

Context comes from two places:

  1. Internal
  2. External

Internal Context

Internal context helps AI understand your project's complexity.

Cursor offers context ranges, from small to large:

Code < Files ≈ Git < Folders < Codebase

This range lets you match context to your problem's scope.

Code/Files/Folders

Choose based on scope:

  1. Code: Specific snippets from current file
  2. Files: Entire files (including images)
  3. Folders: All files in a directory

For large files, Chat reads in chunks. It picks relevant parts based on your question.

Cursor Chat Long Context

Enable long context to include entire files or folders.

Command Palette skips larger contexts like Folders and Codebase. It stays focused on local code.

Git

Git context shows your code's evolution.

Cursor offers these Git contexts:

Cursor Chat Git

Use for code review, optimization, and bug fixes:

  • PR (Diff of Main Branch): Changes from main
  • Pending changes (Commit:Diff with Working State): Unstaged changes
    • Perfect for generating commit messages
  • Committed Changes: All repository commits

Beyond @Git, use the Beta Review feature in the AI Panel.

Enable it in Cursor settings:

Cursor Chat Git Preview

Review streamlines Git code analysis:

Cursor Chat Git Preview

Enter custom review commands above. Select context below, like with @Git.

Codebase

@Codebase scans your entire project for comprehensive context.

Perfect for large projects and cross-file analysis.

It uses RAG to vectorize and store your project locally.

Check indexing status in settings:

Cursor Chat Codebase

@Codebase offers two search modes:

Cursor Chat Codebase

Embedding mode searches local vectors directly.

Reranker mode adds sorting and analysis:

Cursor Chat Codebase

Reranker works better for comprehensive project analysis.

External Context

External context opens AI's world view. It brings in fresh, relevant knowledge.

Cursor offers @Doc and @Web for external info.

Doc

@Doc brings in documentation to expand AI's knowledge.

Reference specific versions or latest docs for your tech stack.

Cursor includes common docs like React:

Cursor Chat Doc

Add custom docs in settings:

Cursor Chat Doc

Provide a URL. Cursor fetches all related docs.

Web

@Web searches online for answers.

Use @Web directly in Chat for auto-search:

Cursor Chat Web

Or @URL for specific pages:

Cursor Chat Web

Context Templates - Notepad

Notepad stores reusable context templates.

Cursor Chat Notepad

With Notepad, you can:

  • Create custom context: Add project details, coding standards, or snippets
  • Reference anywhere: Use in Chat or Composer
Cursor Chat Notepad

Notepad unifies context management. It keeps AI aligned with your project's needs.

Add text and file references to build templates.

Ideally, Notepad would support more reference types, combining all context types we've covered.

Wrap Up

Chat (Cmd+L) handles everything from simple code questions to complex project discussions.

The key? Smart context use. That's what unlocks its full power.