Cursor: The AI-First Code Editor
Learn how to 10x your coding speed using Cursor's advanced AI features.
← Back to Tutorials
What is Cursor?
Cursor is a fork of VS Code that has been fundamentally redesigned from the ground up for AI-assisted programming. Because it is built on VS Code, all of your existing extensions, themes, and keybindings work flawlessly out of the box. However, it integrates powerful AI models (like Claude 3.5 Sonnet and GPT-4o) directly into the editing experience.
Cmd+K: Inline Generation and Editing
The most powerful feature of Cursor is the Cmd+K (Ctrl+K) shortcut. Instead of switching back and forth to a web browser to ask ChatGPT for code snippets, you simply press Cmd+K right where your cursor is.
- Generate New Code: Highlight an empty space, press Cmd+K, and type:
Create a React functional component that fetches data from /api/users - Edit Existing Code: Highlight an existing function, press Cmd+K, and type:
Refactor this to use async/await and add error handling - Cursor will instantly generate a diff in your editor, allowing you to easily accept or reject the changes line by line.
Codebase-Wide Chat (Cmd+L)
Cursor doesn't just read the file you have open; it can read and understand your entire project codebase at once.
- Press Cmd+L to open the Chat Panel.
- Use the @ symbol to explicitly tag files, folders, web documentation, or Git commits to give the AI context. For example:
@Codebase where do we handle user authentication? - Cursor will search through your entire repository, find the relevant files, and provide an accurate answer.
Cursor Composer
Cursor Composer takes AI generation a step further. While Cmd+K edits a single file, Composer can edit multiple files simultaneously to build complex features.
Press Cmd+I to open Composer.
Type: "Add a new settings page for the user profile. It should include a dark mode toggle and save preferences to local storage."
Composer will autonomously create the new HTML, CSS, and JS files required, wire them up to your existing application, and present you with a holistic review of all the changes across your project.