Windsurf allows you to generate new code or edit existing code directly in the editor window through natural language input.
To invoke the command, on a Mac, press ⌘+I
or on Windows/Linux press Ctrl+I
. From here, you can enter natural language prompts and click the Submit button (or press the ⌘+⏎
/Ctrl+⏎
), send the command to the AI. codeium will provide a multi-line proposal that you can choose to accept or reject.
If a piece of code is selected before the command is invoked, the AI edits the contents of the range of selected lines. Otherwise, it generates the code at the cursor position.
You can do this by clicking on the appropriate code lens above the generated diff, or by using the shortcut (Cmd+Enter
/Cmd+Delete
) to accept, reject, or follow up on the generated results.
In Windsurf, you can select the model you want to use for the command by using the drop-down menu.
Codeium Fast is the fastest and most accurate model.
terminal command
You can also open the command in a terminal if you don't remember the exact syntax to run.
best practice
command is well suited for file-wide, inline changes that can be described in natural language. Here are some tips to keep in mind:
- A model that supports commands is larger than a model that supports auto-completion. It is slower but more powerful and is particularly good at following commands.
- If a block of code is selected before calling the command, it will edit the selection. Otherwise, it will do the generation purely.
- Using commands effectively is an art. Simple prompts (such as "Fix this code" or "Refactor") may work because Codeium is context-aware. Specific hints (such as "Write a function that accepts two objects of type
Diffable
inputs and implement the Myers Difference Algorithm"), containing explicit goals and referencing relevant context may help the model work better. - Recommended Reading Windsurf Chinese tutorials, Windsurf installation and use methods