Cursor 编辑器命令速查表 - AI 编辑器 CLI 与 Agent 参数

Cursor 编辑器命令行与 Agent 命令都在这里了,从打开文件到 diff 对比、从扩展管理到 Agent 调用,按场景分类整理,复制即用。

AI 命令行·共 38 条命令·最后更新 2026-08-05
返回 AI 命令行

打开文件与目录 6

cursor .
在当前目录打开为工作区
cursor /path/to/file.ts
打开指定文件
cursor /path/to/file.ts:42
打开文件并跳到第 42 行
cursor /path/to/file.ts:42:10
跳到指定行与列
cursor /path/to/project
打开整个文件夹
cursor file1.ts file2.ts file3.ts
同时打开多个文件

窗口管理 6

cursor -n /path/to/project
在新窗口打开(--new-window)
cursor -r /path/to/file
在已打开窗口中复用(--reuse-window)
cursor -w /path/to/file
等待窗口关闭再返回(--wait,适合 git 编辑器)
cursor --merge
将所有窗口合并到单个窗口
cursor --add /path/to/folder
把目录加入当前工作区(--add/-a)
cursor --locale zh-TW
指定界面语言

对比与合并 2

cursor -d file1.ts file2.ts
并排对比两个文件(--diff)
cursor -m base.ts mine.ts theirs.ts out.ts
三方合并(--merge)

扩展管理 4

cursor --list-extensions
列出已安装扩展
cursor --install-extension esbenp.prettier-vscode
安装指定扩展
cursor --uninstall-extension <id>
卸载指定扩展
cursor --disable-extensions
禁用所有扩展启动

渲染与性能 7

cursor --disable-gpu
禁用 GPU 硬件加速
cursor --disable-hardware-acceleration
禁用硬件加速渲染
cursor --user-data-dir /path/to/data
自定义用户数据目录
cursor --extensions-dir /path/to/ext
自定义扩展目录
cursor --max-memory 4096
限制最大内存(MB)
cursor --verbose /path/to/file
启用详细日志
cursor --status
打印进程使用信息

远程开发 5

cursor --remote ssh-remote+host
连接到配置好的 SSH 远程
cursor --folder-uri vscode-remote://ssh-remote+host/path
打开远程文件夹 URI
cursor --file-uri vscode-remote://.../file.ts
打开远程文件 URI
cursor --proxy-server http://proxy:8080
使用代理服务器
cursor --no-proxy-server
不使用代理

调试与诊断 5

cursor --inspect
启用调试(默认端口 9229)
cursor --inspect-brk
启用调试并在首行暂停
cursor --log error
设置日志级别 trace/debug/info/warn/error/critical
cursor --log-file /tmp/cursor.log
指定日志文件路径
cursor --enable-proposed-api
启用扩展的提议 API

Cursor Agent 与 git 集成 3

cursor-agent -p "你的提问" --mode=ask --output-format text
非交互调用 Cursor Agent(ask/code 模式)
git config --global core.editor "cursor --wait"
把 Cursor 设为 git 提交信息编辑器
cursor --goto file.py:128
跳转到文件指定行(--goto)

💡 提示

  • 终端快开项目:`cursor .` 比鼠标点开快得多;对比改动用 `cursor -d a.ts b.ts` 直接出 diff 视图。
  • 把 Cursor 设为 git 编辑器(`core.editor "cursor --wait"`),提交时自动弹出带行号的编辑器,写完关闭即继续。
  • CI/脚本里用 `--wait` 配合 diff 或编辑器调用,命令会阻塞到窗口关闭,便于串联流程。
  • Cursor Agent 可用 `cursor-agent -p` 非交互调用,适合在流水线里做 ask/code 类自动任务。

官方参考来源

命令整理自以下官方文档,点击核对最新用法。

由 LaoHand 维护

公开更新于 2026年8月5日,内容持续校对官方文档。

发现错误?反馈给我们

命令或描述有误?提交 issue 帮助我们修正。

发现错误?反馈给我们