In this categoryCursor · 26
- How to Install Cursor and Import VS Code Settings (6 Minutes)Start
- Cursor Setup Guide: From Install to Your First AI Edit
- How to Set Up Project Rules in the .cursor/rules Folder
- How to Set Up Codebase Indexing in Cursor
- How to Enforce Project Conventions with Cursor Rules
- How to Write a Team Rule That Applies Only to Certain Files
- How to Migrate a Legacy .cursorrules File to the New Rules Folder
- How to Use Cursor Rules to Guide AI Edits
- How to Set Project Rules in Cursor
- How to Add a .cursorrules File to Steer Cursor
- How to Customize Cursor Keyboard Shortcuts
- How to Edit Multiple Files at Once with Cursor Composer
- How to Use Cursor Tab Completion Effectively
- How to Edit Code Inline with Cmd+K in Cursor
- How to Add Context to Cursor Chat with @ Mentions
- How to Choose and Switch AI Models in Cursor
- How to Add Library Docs as Context with @Docs in Cursor
- How to Generate and Maintain Tests with Cursor Composer
- How to Undo a Composer Change with Checkpoints in Cursor
- How to Use Cursor Agent Mode to Build a Feature End to End
- How to Connect an MCP Server to Cursor
- How to Refactor Across Your Whole Codebase in Cursor
- How to Query Your Database from Cursor with a Postgres MCP Server
- How to Let Cursor Run Commands Automatically (and Keep It Safe)
- How to Build a Full Feature Across Frontend and Backend with Composer
- How to Debug an MCP Server That Will Not Connect in Cursor
How to Set Up Codebase Indexing in Cursor
Build and manage the codebase index so Cursor can find relevant code across your whole repo, and exclude what it should ignore.
Codebase indexing is what lets Cursor answer questions about code you have not opened. It builds an embedding index of your repo so a request can surface the relevant files automatically. This guide shows how to build the index, check its progress, and keep secrets and junk out of it.
What you need
- A project folder open in Cursor
- Cursor signed in (indexing uses the cloud)
- A .gitignore, or willingness to add a .cursorignore
Step 1: Open indexing settings
Go to Settings and find the Indexing section (sometimes under Features). When you open a new project, Cursor usually starts indexing automatically; this screen lets you trigger it manually and watch progress.
Step 2: Build or resync the index
Click the build or resync control. A progress bar shows how many files have been processed. Large repos take a few minutes the first time; after that, only changed files are reindexed, which is fast.
Step 3: Exclude files with .cursorignore
Create a .cursorignore file at the repo root to keep paths out of the index and out of AI context. The syntax is the same as .gitignore. This is the place to exclude build output, large data files, and anything with secrets.
# build + deps
node_modules/
dist/
.next/
# data + secrets
*.csv
*.sqlite
.env
.env.*Step 4: Confirm the index is working
Ask a question about a part of the code you have not opened in this session, like where is rate limiting handled. With a healthy index, Cursor finds and cites the right file without you attaching it.
Result: Cursor answers whole-repo questions and edits the right files even when you have not opened them, while build artifacts and secrets stay out of its reach.
Watch related tutorials
33:42
41:18
28:05
3:12
26:54
39:10New guides in your inbox
Fresh step-by-step how-to guides as we publish them. One email a week, no more.