How to Set Up Cursor, the AI Code Editor (Step by Step)
Cursor is a code editor built on VS Code with AI built in. It has Tab suggestions and an Agent that can read your project, edit files and run commands.
In short: download Cursor, sign in, import your VS Code settings, then use Tab and the Agent (Ctrl+I). To change a few lines, select them and press Ctrl+L to send them to Agent. Put project rules in AGENTS.md.
Why use Cursor
You do not install an AI plugin. The AI is part of the editor. It feels like VS Code, so your shortcuts and most extensions keep working. You can also pick from several AI models in one place.
What you get
- Tab: grey suggestions as you type. Tab accepts.
- Edit selected code: select the lines, press Ctrl+L or Ctrl+K (Mac: Cmd+L or Cmd+K) to send them to Agent, then type what to change. The old separate inline edit box has been retired.
- Agent: side panel (Ctrl+I). It searches your code, edits files and runs terminal commands.
- Plan Mode: Shift+Tab in the Agent box. It researches, asks questions and writes a plan before coding.
- Model picker: switch AI models in the Agent box (Ctrl+/ loops through them).
- Rules: AGENTS.md or .cursor/rules/*.mdc files with your project rules.
How setup flows
Install steps
- Go to cursor.com and download the installer for your system (Windows 10+, macOS 12+, or Linux).
- Windows: run the .exe. Mac: open the .dmg and drag Cursor to Applications.
- Ubuntu/Debian: Cursor has an apt package (preferred over the AppImage, because it updates itself). Copy the exact commands from the Cursor download page.
- Open Cursor and sign in.
- Import VS Code: press Ctrl+Shift+J (Mac Cmd+Shift+J) → General → Account → under VS Code Import click Import. This brings extensions, themes, settings and keybindings.
- Open your project: File → Open Folder.
Settings
- Cursor Settings (Ctrl+Shift+J): models, rules, Tab and privacy options live here.
- Privacy: check the privacy / data-sharing option in Cursor Settings before working on company code. Follow your company policy.
- Extensions: Cursor uses the Open VSX registry, not the VS Code Marketplace. Most popular extensions are there; a few Microsoft-only ones may be missing.
- Shortcuts: same defaults as VS Code, plus AI keys. Change them in the keyboard shortcuts editor.
Configuration: project rules
- AGENTS.md in the project root: simple rules in plain Markdown. Works with other coding agents too.
- .cursor/rules/: one
.mdcfile per rule, with a small header that says when it applies (always, or only for some files). Plain.mdfiles in that folder are ignored. - Keep rules short. They are sent with requests.
# Project rules - Node 20, TypeScript strict - Tests: npm test must pass before you finish - Never edit .env or deploy scripts - Ask before adding a new npm package
First task (5 minutes)
- Press Ctrl+I to open Agent. Ask: “Explain this codebase. Point me to the main entry points.”
- Ask for one small change: “Add input checks to the function in @utils.ts and add a test.” (Type
@to point at a file.) - Watch the diff. Reject anything you do not want.
- Ask it to run your tests. Check the result yourself.
- For a bigger job, press Shift+Tab for Plan Mode first and approve the plan.
| Action | Windows/Linux | Mac |
|---|---|---|
| Agent panel | Ctrl+I | Cmd+I |
| Send selected code to Agent | Ctrl+L or Ctrl+K | Cmd+L or Cmd+K |
| Switch agent mode | Shift+Tab | Shift+Tab |
| Next AI model | Ctrl+/ | Cmd+/ |
| Accept Tab suggestion | Tab | Tab |
Verify your setup: ask Cursor Agent to fix a small chai stall discount bug
Hello friends. The chapter above showed how to install Cursor, sign in and import your VS Code settings. Now we prove the setup works end to end. You will open a tiny folder for a fictional tea stall called Kestrel Chai Stall, see one Tab suggestion, and ask the Agent to fix a discount bug while you review the diff. The starter file fails 3 tests and passes 3, and a correct fix passes all 6.
नमस्कार मित्रांनो. वरच्या chapter मध्ये आपण Cursor install करणं, sign in करणं आणि VS Code settings import करणं पाहिलं. आता setup सुरुवातीपासून शेवटपर्यंत चालतो का ते तपासूया. Kestrel Chai Stall नावाच्या काल्पनिक चहाच्या टपरीचा एक छोटा folder उघडा, एक Tab suggestion बघा, आणि Agent ला discount चा bug fix करायला सांगा, आणि त्याचा diff तुम्ही नीट वाचा. Starter file मध्ये 3 tests fail आणि 3 pass होतात, आणि बरोबर fix केल्यावर सगळे 6 pass होतात.
नमस्ते दोस्तों. ऊपर के chapter में हमने Cursor install करना, sign in करना और VS Code settings import करना देखा. अब setup शुरू से आखिर तक चलता है या नहीं, यह जांचते हैं. Kestrel Chai Stall नाम की काल्पनिक चाय की दुकान का छोटा folder खोलो, एक Tab suggestion देखो, और Agent से discount का bug ठीक करवाओ, और उसका diff ध्यान से पढ़ो. Starter file में 3 tests fail और 3 pass होते हैं, और सही fix के बाद सभी 6 pass होते हैं।
Ravindra Bagale's Tip
Point the Agent at the exact file by typing @ and the file name. Review the diff before you keep it, and remember that Restore Checkpoint can undo the Agent's changes if you do not like them.
Ravindra Bagale's Tip – मराठी
@ आणि file चं नाव टाइप करून Agent ला नेमकी file दाखवा. Diff ठेवण्याआधी वाचा, आणि बदल आवडले नाहीत तर Restore Checkpoint ने Agent चे बदल undo करता येतात हे लक्षात ठेवा.
Ravindra Bagale's Tip – हिंदी
@ और file का नाम लिखकर Agent को सही file दिखाओ. Diff रखने से पहले पढ़ो, और याद रखो कि बदलाव पसंद न आएं तो Restore Checkpoint से Agent के बदलाव undo हो सकते हैं।
Python 3.13.5 and pytest 9.1.1. Starter: 3 failed, 3 passed. Fixed file: 6 passed. The AI tool itself runs on your own computer, so its words will differ from any example here.Your task: open the practice folder in Cursor and ask the Agent to give 10 percent off when an order has 10 or more cups, and to reject an order of fewer than 1 cup with a message that contains cups.
Setup (practice folder kestrel-chai)
- Create the practice folder with the name shown below, and save the two files from this section inside it.
- Create a virtual environment: on macOS or Linux run
python3 -m venv .venv. On Windows runpy -3 -m venv .venv. - Activate it: on macOS or Linux run
source .venv/bin/activate. In Windows Command Prompt run.venv\Scripts\activate.bat, and in Windows PowerShell run.venv\Scripts\Activate.ps1. - Install pytest inside the virtual environment:
python -m pip install pytest.
Starter chai_total.py (the discount starts at 11 cups instead of 10, and 0 cups is accepted):
"""Kestrel Chai Stall bill helper (fictional teaching stall, not a real shop)."""
def chai_total(cups: int, price_per_cup: int = 15) -> float:
"""Return the bill in rupees. Orders of 10 or more cups get 10 percent off."""
# Starter bugs: the discount starts at 11 cups instead of 10, and cups below 1 are not rejected.
total = cups * price_per_cup
if cups > 10:
total = total * 0.9
return round(total, 2)
Simple tests test_chai_total.py:
import pytest
from chai_total import chai_total
def test_one_cup():
assert chai_total(1) == 15
def test_nine_cups_no_discount():
assert chai_total(9) == 135
def test_ten_cups_get_discount():
assert chai_total(10) == 135.0
def test_twelve_cups_get_discount():
assert chai_total(12) == 162.0
def test_custom_price_ten_cups():
assert chai_total(10, price_per_cup=20) == 180.0
def test_zero_cups_rejected():
with pytest.raises(ValueError, match="cups"):
chai_total(0)
Before you ask the AI, run python -m pytest -q in the folder. You should see 3 failed, 3 passed. That proves Python and pytest work before the AI tool is involved.
The exact prompt to try (copy it as it is):
cursor-prompt.txt@chai_total.py Fix chai_total for the fictional Kestrel Chai Stall. Orders of 10 or more cups get 10 percent off, so 10 cups at 15 rupees cost 135.0. Raise ValueError with a message that contains cups when cups is less than 1. Do not change test_chai_total.py. Then run python -m pytest -q.
HOW to verify your Cursor setup
- Open the folder: in Cursor choose File and then Open Folder, and pick
kestrel-chai. - Check Tab: create
scratch.pyand typedef is_even(n):and wait. A grey suggestion should appear, and Tab accepts it. Deletescratch.pyafterwards. - Open the Agent: press Ctrl+I (Mac: Cmd+I). Paste the prompt above. The
@chai_total.pypart attaches that file, and you can also type@and pick the file from the list. - Review the diff: keep the change only if it edits
chai_total.pyand leaves the test file alone. Read any terminal command the Agent wants to run before you allow it. - Run the tests yourself: in the terminal inside the folder, run
python -m pytest -q. Expect 6 passed. - Practise undo once: hover over your prompt in the chat and click Restore Checkpoint to roll back the Agent's change, then ask again. Checkpoints are local and separate from git.
What a correct result looks like: The Agent explains that the discount check should use 10 or more cups instead of more than 10, and it adds a ValueError for fewer than 1 cup. The diff changes cups > 10 to cups >= 10 and adds the check near the top. The result is correct only when pytest shows 6 passed. If the Agent edits test_chai_total.py, reject that change.
Real pytest output after the fixed file:
pytest-after.txt...... [100%]
6 passed in 0.01s
Optional completed chai_total.py (try it yourself first)
The Agent may write the check in a different order. Any version is fine if all 6 tests pass and the test file is unchanged.
chai_total.py"""Kestrel Chai Stall bill helper (fictional teaching stall, not a real shop)."""
def chai_total(cups: int, price_per_cup: int = 15) -> float:
"""Return the bill in rupees. Orders of 10 or more cups get 10 percent off."""
if cups < 1:
raise ValueError("cups must be 1 or more")
total = cups * price_per_cup
if cups >= 10:
total = total * 0.9
return round(total, 2)
Troubleshooting: common Cursor setup problems
- Problem: no Tab suggestions appear. Fix: Free users have a limited Tab allowance that pauses until it resets. Tab also needs internet, and an old version can fail, so press Ctrl+Shift+P (Mac: Cmd+Shift+P) and run Cursor: Attempt Update.
- Problem: AI features stop working on a college or office network. Fix: open Cursor Settings, go to Network, and click Run Diagnostics. If a proxy blocks HTTP/2, set HTTP Compatibility Mode to HTTP/1.1 there and restart Cursor.
- Problem: Tab or the AI shortcuts act strangely after you imported VS Code. Fix: another AI extension may be conflicting. Run Disable All Installed Extensions from the command palette, check again, and turn extensions back on one at a time.
- Problem: the Agent cannot find your file. Fix: check
.cursorignoreand.gitignorein the project root, run Reindex from the command palette, or attach the file directly with@. - Problem: a project rule file is ignored. Fix: files in
.cursor/rulesmust end in.mdc. A plain.mdfile there is ignored, so useAGENTS.mdin the project root for plain Markdown rules. - Problem: a command behaves differently when the Agent runs it. Fix: Cursor sets
CI=1for Agent terminal commands. If your tool changes behaviour in CI, run it asunset CI && your-command. - Problem: Cursor opens to a blank screen. Fix: fully quit Cursor and reopen it. On Mac you can also move Cursor to the Trash and reinstall it from cursor.com/download.
Practice cards: English and spoken Marathi
Each card below explains one idea on its own, so you can save or revise a single card without reading the whole chapter.
Point the Agent at one file
Undo with Restore Checkpoint
Agent ला एकच file दाखवा
Restore Checkpoint ने undo करा
Quick quiz
1. Which shortcut opens the Cursor Agent?
Ctrl+I (Mac: Cmd+I).
2. How do you import VS Code settings?
Ctrl+Shift+J → General → Account → VS Code Import → Import.
3. Which extension registry does Cursor use?
Open VSX.
4. Where do simple project rules go?
AGENTS.md in the project root (or .mdc files in .cursor/rules/).
Save tokens and money
Use Tab suggestions for small changes. For a small edit, select only the lines you need and press Ctrl+L, so Agent works on a small, exact piece of code. Point Agent at files with @ instead of letting it search everything. Start a new chat for each new task.