> ## Documentation Index
> Fetch the complete documentation index at: https://docs.windsurf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Command

> 使用 Windsurf Command（Cmd/Ctrl+I），通过自然语言进行行内代码生成和编辑。无需消耗高级 AI 模型额度。

**Command** 通过自然语言输入，直接在编辑器窗口中生成新代码或编辑现有代码。

<Tip>Command 不会消耗任何高级 AI 模型额度。</Tip>

要调用 Command，在 Mac 上按 `⌘+I`，在 Windows/Linux 上按 `Ctrl+I`。

你可以用自然语言输入提示并点击提交按钮（或 `⌘+⏎`/`Ctrl+⏎`）将指令发送给 AI。

如果在调用 Command 前选中了一段代码，AI 将编辑所选中的行范围；
否则，会在你的光标位置生成代码。

<Frame style={{ border: 'none', background: 'none' }}>
  <img src="https://mintcdn.com/codeium/vRt4FQOyBeZpD2Pu/assets/windsurf-command.png?fit=max&auto=format&n=vRt4FQOyBeZpD2Pu&q=85&s=355f106c06d14c5150b8fd6ade2544d8" width="1786" height="1018" data-path="assets/windsurf-command.png" />
</Frame>

你可以通过点击生成差异上方对应的 code lens，或使用相应快捷键（`Cmd/Ctrl+Enter`/`Cmd/Ctrl+Delete`），来接受、拒绝或继续跟进本次生成。

<div id="models">
  # AI 模型
</div>

Command 自带一组专为当前文件编辑优化的 AI 模型。

<Frame>
  <video autoPlay muted loop playsInline src="https://mintcdn.com/codeium/vRt4FQOyBeZpD2Pu/assets/windsurf-command-models.mp4?fit=max&auto=format&n=vRt4FQOyBeZpD2Pu&q=85&s=56ff76bccc777e7bb30af7d4a4991325" data-path="assets/windsurf-command-models.mp4" />
</Frame>

<Tip>Windsurf Fast 是目前可用的最快且最准确的 AI 模型。</Tip>

<div id="terminal-command">
  # 终端 Command
</div>

你可以在终端中使用 Command（`Cmd/Ctrl+I`），通过自然语言提示生成正确的 CLI 命令语法。

<Frame style={{ border: 'none', background: 'none' }}>
  <img src="https://mintcdn.com/codeium/qJj_RRojefb93yIg/assets/windsurf-terminal-command.png?fit=max&auto=format&n=qJj_RRojefb93yIg&q=85&s=b03f1498ac0b7dc344270f975f9a234f" width="980" height="164" data-path="assets/windsurf-terminal-command.png" />
</Frame>

<div id="best-practices">
  # 最佳实践
</div>

Command 非常适合以文件为范围的内联修改，你可以用自然语言指令来描述这些更改。
请注意以下要点：

* 为 Command 提供支持的 AI 模型比为 Autocomplete 提供支持的模型更大。
  它更慢但更强大，并且经过训练，在遵循指令方面表现尤为出色。

  * 如果你在调用 Command 前先高亮选中一段代码，它会编辑所选内容；否则，它将进行纯生成。

  * 要高效使用 Command 需要一些技巧。像 “Fix this” 或 “Refactor” 这样的简短提示通常就能奏效，
    这得益于 Windsurf 的上下文感知能力。
    而像 “Write a function that takes two inputs of type `Diffable` and implements the Myers diff algorithm”
    这类包含明确目标并引用相关上下文的具体提示，可能会对模型帮助更大。
