1. 首先在项目根目录创建配置:
# 创建.cursor目录和配置文件
mkdir -p .cursor
touch .cursor/config.json
2. 编辑配置文件内容:
{
"chat": {
"saveHistory": true,
"historyPath": ".cursor/chat_history",
"conversationsPath": ".cursorconversations",
"maxHistorySize": 1000,
"autoSave": true,
"saveInterval": 300
},
"editor": {
"autosave": true
}
}
3. 创建历史记录目录:
# 创建历史记录目录
mkdir -p .cursor/chat_history
# 创建会话文件
touch .cursorconversations
# 设置权限
chmod 755 .cursor
chmod 644 .cursor/config.json
chmod 755 .cursor/chat_history
chmod 666 .cursorconversations
4. 如果是在WSL中使用,建议:
# 使用绝对路径配置
{
"chat": {
"saveHistory": true,
"historyPath": "/mnt/c/Users/你的用户名/项目路径/.cursor/chat_history",
"conversationsPath": "/mnt/c/Users/你的用户名/项目路径/.cursorconversations"
}
}
5. 在.gitignore中添加:
.cursor/
.cursorconversations
配置说明:
saveHistory: 启用历史记录保存
historyPath: 历史记录保存路径
conversationsPath: 会话文件保存路径
maxHistorySize: 最大保存的对话数量
autoSave: 自动保存功能
saveInterval: 自动保存间隔(秒)
完成配置后,需要:
- 重启Cursor编辑器
- 测试新建会话是否正常保存