Skip to content

Cursor

Tab completion

Unlike Github Copilot, Cursor can edit the code around your cursor. It has a history of your recent changes in the context window, so it can predict what you are trying to do next.

If available, you can press Tab to move to the next location, allowing you to quickly navigate through changes.

Cursor’s tab completion in TypeScript can also automatically import functions and modules when they are used but not yet imported.

Composer

Composer is your AI coding assistant. It has two modes, Normal and Agent. Use ⌘I to open it, and ⌘N to create a new Composer.

Agent

Modes

Normal

In Normal mode, Cursor operates in an interactive code-writing environment where you can edit, iterate, and receive AI-powered code suggestions within the editor.

Agent

In Agent mode, Cursor takes a more autonomous approach, executing tasks on its own, running commands, fetching data, and modifying code proactively without requiring manual prompts. Agent can perform many consecutive actions without much supervision.

Context

In all “input boxes” (such as Composer or Chat for example), you can use @ symbols and a popup menu will appear with a list of suggestions and automatically filter to only show the most relevant suggestions based on your input. This allows provide context to the AI.

You can find the list of all available context symbols in the Cursor documentation.

Chat

It lets you ask questions or solve problems in your codebase with the most capable language models, all in your editor. By default it takes the context of the current file.

Chat will suggest you code changes and you can apply them directly in the editor.

Composer VS Chat

Composer mode is designed for structured code generation and iteration, where you can work on a file or snippet interactively, refining code with AI-assisted suggestions. It is useful for writing, refactoring, and improving code in a more controlled manner.

Chat mode is a conversational interface where you can ask questions, get explanations, and receive general coding guidance. It excels in brainstorming, debugging assistance, and discussing implementation strategies rather than direct file editing.

(⌘K)

You can this shortcut in two different places :

  • In the editor, it will open the code generation prompt, allowing you to generate, modify, or refactor code using AI suggestions.
  • In the terminal, it will open the terminal prompt, enabling AI-assisted command generation, explanations, or modifications for shell commands..

AI Commit Message

Cursor can help you generate meaningful commit messages for your changes with just a click. Here’s how to use this feature :

  1. Stage the files you want to commit
  2. Open the Git tab in the sidebar
  3. Look for the sparkle (✨) icon next to the commit message input field
  4. Click the sparkle icon to generate a commit message based on your staged changes

The generated commit message will be based on the changes in your staged files and your repository’s git history. This means Cursor will analyze both your current changes and previous commit messages to generate a contextually appropriate message.

Commit message generation

Bind a shortcut

You can bind the generate commit message feature to a keyboard shortcut:

  1. Open the Command Palette (⌘ + Shift + P).
  2. Search for open shortcut json
  3. Add the following to the opened file:
{
"key": "cmd+m",
"command": "cursor.generateGitCommitMessage"
}
  1. Now, you can generate a commit message by pressing ⌘ + M.

Rules

Global rules

Global rules can be added by modifying the Rules for AI section under Cursor Settings > General > Rules for AI. This is useful if you want to specify rules that should always be included in every project like output language, length of responses etc.

Project rules

In your project, rules are stored in the .cursor/rule directory (.mdc files), allowing you to define AI behavior for different technologies. For each technology used, you can create a dedicated rules file to enforce best practices.

Example: PHP rules

Cursor Project Rules

Now, using chat or composer, Cursor will follow the rules: Cursor Project Rules Demo

Public templates

You can find some of the best rule files using Cursor Directory.

Useful shortcuts

ShortcutDescription
⌘ + KOpen the code generation prompt
⌘ + IOpen Composer
⌘ + .Toggle Agent in Composer
⌘ + LOpen Chat

You can find more shortcuts in the Cursor documentation.