Cursor 提供命令列工具,讓你能從終端開啟檔案與資料夾。安裝 cursorcode 兩個指令,把 Cursor 整合進你的開發流程。

安裝 CLI 指令

透過 Command Palette 安裝 CLI 指令:
  1. 開啟 Command Palette(Cmd/Ctrl + P)
  2. 輸入「Install」以篩選安裝指令
  3. 選取並執行 Install 'cursor' to shell
  4. 重複一次並選取 Install 'code' to shell

使用 CLI 指令

安裝完成後,可用以下任一指令在 Cursor 中開啟檔案或資料夾:
# 使用 cursor 指令
cursor path/to/file.js
cursor path/to/folder/

# 使用 code 指令(與 VS Code 相容)
code path/to/file.js
code path/to/folder/

指令選項

兩個指令都支援以下選項:
  • 開啟檔案:cursor file.js
  • 開啟資料夾:cursor ./my-project
  • 開啟多個項目:cursor file1.js file2.js folder1/
  • 在新視窗開啟:cursor -ncursor --new-window
  • 等待視窗關閉後再結束:cursor -wcursor --wait

常見問題