文章

Cursor1.x教程

Cursor1.x教程

Cursor

https://docs.cursor.com/welcome

什么是 Cursor?

界面

v0.5 设置界面:

image.png

v1.13 设置界面:

image.png

Installation

https://docs.cursor.com/get-started/installation

Cursor 付费

野卡

开通 wildcard 支付会员
复制下方链接,进入 wildcard 官网,并完成登录注册。
链接:https://bewildcard.com/i/D4X7JXA7

Cursor 是什么?国内如何购买支付 Cursor Pro 教程
https://zhuanlan.zhihu.com/p/17663097850

Cursor Editor

Cursor Tab

  • 本地代码补全功能
  • Auto-import 自动导包

Composer(v1.0 叫 Agent)

可基于整个 codebase 来回答问题和修改代码。

v1.0 之前,Ask/Edit/Agent 模式旧版本

  1. Ask 模式
        - 用于理解代码并获取解释
        - 可以询问有关代码功能、架构的问题
        - 适合学习和理解复杂代码库
  2. Edit 模式
        - 通过自然语言指令修改代码
        - 可以请求重构、优化或添加新功能
        - 智能理解你的意图并精确执行
  3. Agent 模式
        - 完全自动化的编程助手
        - 可以根据高级描述自动完成整个开发任务
        - 处理多文件协调和依赖关系

v1.0 及以后,Ask/Agent/Manual Mode

Agent mode

同上面 Agent 模式

Ask mode

同上面的 Ask 模式;只读的,不能修改代码;适合学习和理解代码库

Manual mode

提供更精准的修改;不像 Agent mode 遍历整个 codebase,只基于你给定的 instructions 或 context(例如 @ 提供的文件)。

Custom Modes

inline edit (Ctrl+K)

在一个 Prompt Bar 生成、编辑和问问题。

image.png

  • 也可以在 Terminal 按 Ctrl+K

Background Agents

  • 要上传代码到远程执行;为了安全,所在的 Team 的可能会禁用该功能
  • Ctrl+E

高级

Keyboard Shortcuts

https://docs.cursor.com/kbd

AI Commit Message

  • 切换到 git tab
  • 点击 ✨

Cursor Context

Codebase Indexing

  • 每次打开项目会进行 indexing,这个过程会比较慢
  • 查看 indexing 状态
        * 旧版本:Cursor Settings > Features > Codebase Indexing.
        * v1.0+: Cursor Settings > Indexing&Docs
  • 需要忽略 indexing 的文件:.cursorignore,添加到 git 全局忽略列表 (.gitignore) 中去

Cursor Rules

具体 Rules 见: [[Cursor 开源]]

https://docs.cursor.com/context/rules

Project Rules

  • 存储在 .cursor/rules,需要版本控制
  • 每个子目录都可以有其 .cursor/rules

作用:

  1. 关于代码库的特定领域知识
  2. 自动化的项目 workflows or templates
  3. 标准化的样式和架构决策

MDC 格式

User Rules

对所有项目生效,会被引入到 model context

image.png

不支持 MDC,就一个纯文本,如:

1
Please reply in a concise style. Avoid unnecessary repetition or filler language.

Memories

  • 在 chat 会话中自动生成
  • 在 private mode 不可用;

.cursorrules (Legacy)

项目根目录 .cursorrules 文件,也支持,不过过时了,推荐升级到 Project Rules

Managing Context

添加模型上下文 Context

image.png

Status

  • Condensed 文件或文件夹太大,压缩保留关键词 image.png

  • Significantly Condensed condensed 后还是太大,这种只有 file name 添加到我们的 Context
  • Not included 出现下面 warn 图标,太大不被 include image.png

Summarization

每个模型的 context window 容量有限,且容量不太一样(比如 200 K tokens);

当 context window 快满了,Cursor 会自动 summarize 对话确保 model 能响应

@ Symbols

image.png

  • @Files - Reference specific files in your project

  • @Folders - Reference entire folders for broader context

  • @Code - Reference specific code snippets or symbols from your codebase

  • @Docs - Access documentation and guides

  • @Git - Access git history and changes

  • @Notepads - Access notepads

  • @Past Chats - Work with summarized composer sessions

  • @Cursor Rules - Work with cursor rules

  • @Web - Reference external web resources and documentation

  • @Link (paste) - Create links to specific code or documentation

  • @Recent Changes - Create links to specific code or documentation

  • @Lint Errors - Reference lint errors (Chat only)

  • @Definitions - Look up symbol definitions (Cmd K only) There are also some other symbols that can be used:

  • # Files - Add files to the context without referencing

  • / Commands - Add open and active files to the context

Ignore Files

忽略文件。

https://docs.cursor.com/context/ignore-files

MCP (Model Context Protocol)

https://docs.cursor.com/context/model-context-protocol

见:[[MCP]]

Max Mode

https://docs.cursor.com/context/max-mode

提升 AI 的能力。贵。

Integrations

BugBot

AI Code Review

Slack

Work with Background Agents from Slack

Cursor 破解(仅供学习)

https://github.com/yeongpin/cursor-free-vip

https://github.com/aigem/cursor-pro-trial

https://github.com/agentcodee/cursor-free-everyday

Cursor 教程

You are using Cursor AI incorrectly…
https://ghuntley.com/stdlib/

本文由作者按照 CC BY 4.0 进行授权