cursor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cursor Skill

Cursor 使用技巧

Use the
cursor
CLI to control the Cursor AI-powered code editor (VS Code fork).
使用
cursor
CLI来控制由AI驱动的代码编辑器Cursor(VS Code分支版本)。

CLI Location

CLI 位置

bash
/usr/local/bin/cursor
bash
/usr/local/bin/cursor

Opening Files and Folders

打开文件与文件夹

Open current directory:
bash
cursor .
Open specific file:
bash
cursor /path/to/file.ts
Open file at specific line:
bash
cursor /path/to/file.ts:42
Open file at line and column:
bash
cursor /path/to/file.ts:42:10
Open folder:
bash
cursor /path/to/project
Open multiple files:
bash
cursor file1.ts file2.ts file3.ts
打开当前目录:
bash
cursor .
打开指定文件:
bash
cursor /path/to/file.ts
打开文件并定位到指定行:
bash
cursor /path/to/file.ts:42
打开文件并定位到指定行和列:
bash
cursor /path/to/file.ts:42:10
打开文件夹:
bash
cursor /path/to/project
打开多个文件:
bash
cursor file1.ts file2.ts file3.ts

Window Options

窗口选项

Open in new window:
bash
cursor -n /path/to/project
Open in new window (alias):
bash
cursor --new-window /path/to/project
Reuse existing window:
bash
cursor -r /path/to/file
Reuse existing window (alias):
bash
cursor --reuse-window /path/to/file
在新窗口中打开:
bash
cursor -n /path/to/project
在新窗口中打开(别名):
bash
cursor --new-window /path/to/project
复用现有窗口:
bash
cursor -r /path/to/file
复用现有窗口(别名):
bash
cursor --reuse-window /path/to/file

Diff Mode

对比模式

Compare two files:
bash
cursor -d file1.ts file2.ts
Diff (alias):
bash
cursor --diff file1.ts file2.ts
对比两个文件:
bash
cursor -d file1.ts file2.ts
对比(别名):
bash
cursor --diff file1.ts file2.ts

Wait Mode

等待模式

Wait for file to close (useful in scripts):
bash
cursor --wait /path/to/file
Short form:
bash
cursor -w /path/to/file
Use as git editor:
bash
git config --global core.editor "cursor --wait"
等待文件关闭(在脚本中很实用):
bash
cursor --wait /path/to/file
简写形式:
bash
cursor -w /path/to/file
作为Git编辑器使用:
bash
git config --global core.editor "cursor --wait"

Adding to Workspace

添加到工作区

Add folder to current workspace:
bash
cursor --add /path/to/folder
将文件夹添加到当前工作区:
bash
cursor --add /path/to/folder

Extensions

扩展管理

List installed extensions:
bash
cursor --list-extensions
Install extension:
bash
cursor --install-extension <extension-id>
Uninstall extension:
bash
cursor --uninstall-extension <extension-id>
Disable all extensions:
bash
cursor --disable-extensions
列出已安装的扩展:
bash
cursor --list-extensions
安装扩展:
bash
cursor --install-extension <extension-id>
卸载扩展:
bash
cursor --uninstall-extension <extension-id>
禁用所有扩展:
bash
cursor --disable-extensions

Verbose and Debugging

详细输出与调试

Show version:
bash
cursor --version
Show help:
bash
cursor --help
Verbose output:
bash
cursor --verbose /path/to/file
Open developer tools:
bash
cursor --inspect-extensions
查看版本:
bash
cursor --version
查看帮助:
bash
cursor --help
详细输出:
bash
cursor --verbose /path/to/file
打开开发者工具:
bash
cursor --inspect-extensions

Settings

设置

User settings location:
~/Library/Application Support/Cursor/User/settings.json
Keybindings location:
~/Library/Application Support/Cursor/User/keybindings.json
用户设置位置:
~/Library/Application Support/Cursor/User/settings.json
快捷键设置位置:
~/Library/Application Support/Cursor/User/keybindings.json

Portable Mode / Profiles

便携模式 / 配置文件

Specify user data directory:
bash
cursor --user-data-dir /path/to/data
Specify extensions directory:
bash
cursor --extensions-dir /path/to/extensions
指定用户数据目录:
bash
cursor --user-data-dir /path/to/data
指定扩展目录:
bash
cursor --extensions-dir /path/to/extensions

Piping Input

管道输入

Read from stdin:
bash
echo "console.log('hello')" | cursor -
从标准输入读取内容:
bash
echo "console.log('hello')" | cursor -

Remote Development

远程开发

Cursor supports remote development similar to VS Code. SSH remotes are configured in:
~/.ssh/config
Then use command palette or remote explorer in the GUI.
Cursor支持与VS Code类似的远程开发功能。SSH远程连接配置在:
~/.ssh/config
然后可在GUI中使用命令面板或远程资源管理器进行操作。