在 Cursor 中打开项目
- 确保已安装 git
- 克隆示例项目:
- 自动补全多行和代码块
- 在文件内及跨文件跳转到下一个自动补全建议
- 开始输入一个函数名的开头:
- 将自动出现 Tab 的建议
- 按 Tab 接受建议
- Cursor 会补全参数和函数体
使用 Inline Edit 编辑选区
- 选中你刚创建的函数
- 按下 Ctrl+K
- 输入 “make this function calculate fibonacci numbers”
- 按下 Enter 应用更改
- Cursor 会自动添加 import 和文档
- 打开 Chat 面板(Ctrl+I)
- 输入:“Add tests for this function and run them”
- Agent 会为你创建测试文件、编写测试用例并运行它们
额外技巧
把工作交给 Background Agent
把工作交给 Background Agent
- 打开 Background Agent 控制面板 (Ctrl+E)
- 提问:“Find and fix a bug in this project”
- Background Agent 将:
- 创建远程虚拟机(VM)
- 浏览你的项目
- 发现缺陷
- 提出修复方案
编写规则
编写规则
- 打开命令面板 (Ctrl+Shift+P) 2. 搜索:“New Cursor
Rule” 3. 命名(例如
style-guide
) 4. 选择规则类型 “Always” 5. 定义 你的风格:Prefer using camelCase for variable names
设置 MCP 服务器
设置 MCP 服务器
- 访问我们的 MCP 目录
- 选择一个工具
- 点击 “Install”
- 打开 Cursor Settings (Ctrl+Shift+J)
- 前往 “Tools & Integrations”
- 点击 “New MCP Server”