1# Edit Prediction
2
3Edit Prediction is Zed's LLM mechanism for predicting the code you want to write.
4Each keystroke sends a new request to the edit prediction provider, which returns individual or multi-line suggestions that can be quickly accepted by pressing `tab`.
5
6The default provider is [Zeta, a proprietary open source and open dataset model](https://huggingface.co/zed-industries/zeta), but you can also use [other providers](#other-providers) like GitHub Copilot, Supermaven, and Codestral.
7
8## Configuring Zeta
9
10To use Zeta, [sign in](../authentication.md#what-features-require-signing-in).
11Once signed in, predictions appear as you type.
12
13You can confirm that Zeta is properly configured either by verifying whether you have the following code in your `settings.json`:
14
15```json [settings]
16"features": {
17 "edit_prediction_provider": "zed"
18},
19```
20
21The Z icon in the status bar also indicates Zeta is active.
22
23### Pricing and Plans
24
25The free plan includes 2,000 Zeta predictions per month. The [Pro plan](../ai/plans-and-usage.md) removes this limit. See [Zed's pricing page](https://zed.dev/pricing) for details.
26
27### Switching Modes {#switching-modes}
28
29Zed's Edit Prediction comes with two different display modes:
30
311. `eager` (default): predictions are displayed inline as long as it doesn't conflict with language server completions
322. `subtle`: predictions only appear inline when holding a modifier key (`alt` by default)
33
34Toggle between them via the `mode` key:
35
36```json [settings]
37"edit_predictions": {
38 "mode": "eager" // or "subtle"
39},
40```
41
42Or directly via the UI through the status bar menu:
43
44
45
46> Note that edit prediction modes work with any prediction provider.
47
48### Conflict With Other `tab` Actions {#edit-predictions-conflict}
49
50By default, when `tab` would normally perform a different action, Zed requires a modifier key to accept predictions:
51
521. When the language server completions menu is visible.
532. When your cursor isn't at the right indentation level.
54
55In these cases, `alt-tab` is used instead to accept the prediction. When the language server completions menu is open, holding `alt` first will cause it to temporarily disappear in order to preview the prediction within the buffer.
56
57On Linux, `alt-tab` is often used by the window manager for switching windows, so `alt-l` is provided as the default binding for accepting predictions. `tab` and `alt-tab` also work, but aren't displayed by default.
58
59{#action editor::AcceptNextWordEditPrediction} ({#kb editor::AcceptNextWordEditPrediction}) can be used to accept the current edit prediction up to the next word boundary.
60{#action editor::AcceptNextLineEditPrediction} ({#kb editor::AcceptNextLineEditPrediction}) can be used to accept the current edit prediction up to the new line boundary.
61
62## Configuring Edit Prediction Keybindings {#edit-predictions-keybinding}
63
64By default, `tab` is used to accept edit predictions. You can use another keybinding by inserting this in your keymap:
65
66```json [settings]
67{
68 "context": "Editor && edit_prediction",
69 "bindings": {
70 // Here we also allow `alt-enter` to accept the prediction
71 "alt-enter": "editor::AcceptEditPrediction"
72 }
73}
74```
75
76When there's a [conflict with the `tab` key](#edit-predictions-conflict), Zed uses a different key context to accept keybindings (`edit_prediction_conflict`).
77If you want to use a different one, you can insert this in your keymap:
78
79```json [settings]
80{
81 "context": "Editor && edit_prediction_conflict",
82 "bindings": {
83 "ctrl-enter": "editor::AcceptEditPrediction" // Example of a modified keybinding
84 }
85}
86```
87
88If your keybinding contains a modifier (`ctrl` in the example above), it will also be used to preview the edit prediction and temporarily hide the language server completion menu.
89
90You can also bind this action to keybind without a modifier.
91In that case, Zed will use the default modifier (`alt`) to preview the edit prediction.
92
93```json [settings]
94{
95 "context": "Editor && edit_prediction_conflict",
96 "bindings": {
97 // Here we bind tab to accept even when there's a language server completion
98 // or the cursor isn't at the correct indentation level
99 "tab": "editor::AcceptEditPrediction"
100 }
101}
102```
103
104To maintain the use of the modifier key for accepting predictions when there is a language server completions menu, but allow `tab` to accept predictions regardless of cursor position, you can specify the context further with `showing_completions`:
105
106```json [settings]
107{
108 "context": "Editor && edit_prediction_conflict && !showing_completions",
109 "bindings": {
110 // Here we don't require a modifier unless there's a language server completion
111 "tab": "editor::AcceptEditPrediction"
112 }
113}
114```
115
116### Keybinding Example: Always Use Tab
117
118If you want to use `tab` to always accept edit predictions, you can use the following keybinding:
119
120```json [keymap]
121{
122 "context": "Editor && edit_prediction_conflict && showing_completions",
123 "bindings": {
124 "tab": "editor::AcceptEditPrediction"
125 }
126}
127```
128
129This will make `tab` work to accept edit predictions _even when_ you're also seeing language server completions.
130That means that you need to rely on `enter` for accepting the latter.
131
132### Keybinding Example: Always Use Alt-Tab
133
134The keybinding example below causes `alt-tab` to always be used instead of sometimes using `tab`.
135You might want this in order to have just one (alternative) keybinding to use for accepting edit predictions, since the behavior of `tab` varies based on context.
136
137```json [keymap]
138 {
139 "context": "Editor && edit_prediction",
140 "bindings": {
141 "alt-tab": "editor::AcceptEditPrediction"
142 }
143 },
144 // Bind `tab` back to its original behavior.
145 {
146 "context": "Editor",
147 "bindings": {
148 "tab": "editor::Tab"
149 }
150 },
151 {
152 "context": "Editor && showing_completions",
153 "bindings": {
154 "tab": "editor::ComposeCompletion"
155 }
156 },
157```
158
159If you are using [Vim mode](../vim.md), then additional bindings are needed after the above to return `tab` to its original behavior:
160
161```json [keymap]
162 {
163 "context": "(VimControl && !menu) || vim_mode == replace || vim_mode == waiting",
164 "bindings": {
165 "tab": "vim::Tab"
166 }
167 },
168 {
169 "context": "vim_mode == literal",
170 "bindings": {
171 "tab": ["vim::Literal", ["tab", "\u0009"]]
172 }
173 },
174```
175
176### Keybinding Example: Displaying Tab and Alt-Tab on Linux
177
178While `tab` and `alt-tab` are supported on Linux, `alt-l` is displayed instead.
179If your window manager does not reserve `alt-tab`, and you would prefer to use `tab` and `alt-tab`, include these bindings in `keymap.json`:
180
181```json [keymap]
182 {
183 "context": "Editor && edit_prediction",
184 "bindings": {
185 "tab": "editor::AcceptEditPrediction",
186 // Optional: This makes the default `alt-l` binding do nothing.
187 "alt-l": null
188 }
189 },
190 {
191 "context": "Editor && edit_prediction_conflict",
192 "bindings": {
193 "alt-tab": "editor::AcceptEditPrediction",
194 // Optional: This makes the default `alt-l` binding do nothing.
195 "alt-l": null
196 }
197 },
198```
199
200### Missing keybind {#edit-predictions-missing-keybinding}
201
202Zed requires at least one keybinding for the {#action editor::AcceptEditPrediction} action in both the `Editor && edit_prediction` and `Editor && edit_prediction_conflict` contexts ([learn more above](#edit-predictions-keybinding)).
203
204If you have previously bound the default keybindings to different actions in the global context, you will not be able to preview or accept edit predictions. For example:
205
206```json [keymap]
207[
208 // Your keymap
209 {
210 "bindings": {
211 // Binds `alt-tab` to a different action globally
212 "alt-tab": "menu::SelectNext"
213 }
214 }
215]
216```
217
218To fix this, you can specify your own keybinding for accepting edit predictions:
219
220```json [keymap]
221[
222 // ...
223 {
224 "context": "Editor && edit_prediction_conflict",
225 "bindings": {
226 "alt-l": "editor::AcceptEditPrediction"
227 }
228 }
229]
230```
231
232If you would like to use the default keybinding, you can free it up by either moving yours to a more specific context or changing it to something else.
233
234## Disabling Automatic Edit Prediction
235
236You can disable edit predictions at several levels, or turn them off entirely.
237
238Alternatively, if you have Zed set as your provider, consider [using Subtle Mode](#switching-modes).
239
240### On Buffers
241
242To not have predictions appear automatically as you type, set this within `settings.json`:
243
244```json [settings]
245{
246 "show_edit_predictions": false
247}
248```
249
250This hides every indication that there is a prediction available, regardless of [the display mode](#switching-modes) you're in (valid only if you have Zed as your provider).
251Still, you can trigger edit predictions manually by executing {#action editor::ShowEditPrediction} or hitting {#kb editor::ShowEditPrediction}.
252
253### For Specific Languages
254
255To not have predictions appear automatically as you type when working with a specific language, set this within `settings.json`:
256
257```json [settings]
258{
259 "language": {
260 "python": {
261 "show_edit_predictions": false
262 }
263 }
264}
265```
266
267### In Specific Directories
268
269To disable edit predictions for specific directories or files, set this within `settings.json`:
270
271```json [settings]
272{
273 "edit_predictions": {
274 "disabled_globs": ["~/.config/zed/settings.json"]
275 }
276}
277```
278
279### Turning Off Completely
280
281To completely turn off edit prediction across all providers, explicitly set the settings to `none`, like so:
282
283```json [settings]
284"features": {
285 "edit_prediction_provider": "none"
286},
287```
288
289## Configuring Other Providers {#other-providers}
290
291Edit Prediction also works with other providers.
292
293### GitHub Copilot {#github-copilot}
294
295To use GitHub Copilot as your provider, set this within `settings.json`:
296
297```json [settings]
298{
299 "features": {
300 "edit_prediction_provider": "copilot"
301 }
302}
303```
304
305To sign in to GitHub Copilot, click on the Copilot icon in the status bar. A popup window appears displaying a device code. Click the copy button to copy the code, then click "Connect to GitHub" to open the GitHub verification page in your browser. Paste the code when prompted. The popup window closes automatically after successful authorization.
306
307#### Using GitHub Copilot Enterprise
308
309If your organization uses GitHub Copilot Enterprise, you can configure Zed to use your enterprise instance by specifying the enterprise URI in your `settings.json`:
310
311```json [settings]
312{
313 "edit_predictions": {
314 "copilot": {
315 "enterprise_uri": "https://your.enterprise.domain"
316 }
317 }
318}
319```
320
321Replace `"https://your.enterprise.domain"` with the URL provided by your GitHub Enterprise administrator (e.g., `https://foo.ghe.com`).
322
323Once set, Zed will route Copilot requests through your enterprise endpoint.
324When you sign in by clicking the Copilot icon in the status bar, you will be redirected to your configured enterprise URL to complete authentication.
325All other Copilot features and usage remain the same.
326
327Copilot can provide multiple completion alternatives, and these can be navigated with the following actions:
328
329- {#action editor::NextEditPrediction} ({#kb editor::NextEditPrediction}): To cycle to the next edit prediction
330- {#action editor::PreviousEditPrediction} ({#kb editor::PreviousEditPrediction}): To cycle to the previous edit prediction
331
332### Sweep {#sweep}
333
334To use [Sweep](https://sweep.dev/) as your provider:
335
3361. Open the Settings Editor (`Cmd+,` on macOS, `Ctrl+,` on Linux/Windows)
3372. Search for "Edit Predictions" and click **Configure Providers**
3383. Find the Sweep section and enter your API key from the
339 [Sweep dashboard](https://app.sweep.dev/)
340
341Alternatively, click the edit prediction icon in the status bar and select
342**Configure Providers** from the menu.
343
344After adding your API key, Sweep will appear in the provider dropdown in the status bar menu, where you can select it. You can also set it directly in `settings.json`:
345
346```json [settings]
347{
348 "features": {
349 "edit_prediction_provider": "sweep"
350 }
351}
352```
353
354### Mercury Coder {#mercury-coder}
355
356To use [Mercury Coder](https://www.inceptionlabs.ai/) by Inception Labs as your provider:
357
3581. Open the Settings Editor (`Cmd+,` on macOS, `Ctrl+,` on Linux/Windows)
3592. Search for "Edit Predictions" and click **Configure Providers**
3603. Find the Mercury section and enter your API key from the
361 [Inception Labs dashboard](https://platform.inceptionlabs.ai/dashboard/api-keys)
362
363Alternatively, click the edit prediction icon in the status bar and select
364**Configure Providers** from the menu.
365
366After adding your API key, Mercury Coder will appear in the provider dropdown in the status bar menu, where you can select it. You can also set it directly in `settings.json`:
367
368```json [settings]
369{
370 "features": {
371 "edit_prediction_provider": "mercury"
372 }
373}
374```
375
376### Codestral {#codestral}
377
378To use Mistral's Codestral as your provider:
379
3801. Open the Settings Editor (`Cmd+,` on macOS, `Ctrl+,` on Linux/Windows)
3812. Search for "Edit Predictions" and click **Configure Providers**
3823. Find the Codestral section and enter your API key from the
383 [Codestral dashboard](https://console.mistral.ai/codestral)
384
385Alternatively, click the edit prediction icon in the status bar and select
386**Configure Providers** from the menu.
387
388After adding your API key, Codestral will appear in the provider dropdown in the status bar menu, where you can select it. You can also set it directly in `settings.json`:
389
390```json [settings]
391{
392 "features": {
393 "edit_prediction_provider": "codestral"
394 }
395}
396```
397
398## See also
399
400- [Agent Panel](./agent-panel.md): Agentic editing with file read/write and terminal access
401- [Inline Assistant](./inline-assistant.md): Prompt-driven transformations on selected code