configuring_zed__key_bindings.md

  1Zed can be configured via a simple JSON file located at `~/.config/zed/keymap.json`.
  2
  3### Predefined keymaps
  4
  5We have a growing collection of pre-defined keymaps in our [keymaps repository](https://github.com/zed-industries/keymaps).
  6
  7### Custom key bindings
  8
  9#### Accessing custom key bindings
 10
 11You can open `keymap.json` via `CMD + K, CMD + S`, the command palette, or the `Zed > Settings > Open Key Bindings` application menu item.
 12
 13#### Adding a custom key binding
 14
 15To customize key bindings, specify a context and the list of bindings to set. Re-mapping an existing binding will clobber the existing binding in favor of the custom one.
 16
 17An example of adding a set of custom key bindings:
 18
 19```json
 20[
 21    {
 22        "context": "Editor",
 23        "bindings": {
 24            "ctrl-w": "editor::SelectLargerSyntaxNode",
 25            "ctrl-shift-W": "editor::SelectSmallerSyntaxNode",
 26            "ctrl-c": "editor::Cancel"
 27        }
 28    }
 29]
 30```
 31
 32You can see more examples in Zed's [`default.json`](https://zed.dev/ref/default.json)
 33
 34_There are some key bindings that can't be overridden; we are working on an issue surrounding this._
 35
 36### All key bindings
 37
 38#### Global
 39
 40| **Command**                      | **Target**     | **Default Shortcut**           |
 41| -------------------------------- | -------------- | ------------------------------ |
 42| Open recent                      | Branches       | `Alt + Command + B`            |
 43| Toggle focus                     | Collab Panel   | `Command + Shift + C`          |
 44| Toggle inlay hints               | Editor         | `Control + :`                  |
 45| Cancel                           | Menu           | `Control + C`                  |
 46| Cancel                           | Menu           | `Escape`                       |
 47| Confirm                          | Menu           | `Enter`                        |
 48| Secondary confirm                | Menu           | `Command + Enter`              |
 49| Select first                     | Menu           | `Command + Up`                 |
 50| Select first                     | Menu           | `Page Up`                      |
 51| Select first                     | Menu           | `Shift + Page Down`            |
 52| Select first                     | Menu           | `Shift + Page Up`              |
 53| Select last                      | Menu           | `Command + Down`               |
 54| Select last                      | Menu           | `Page Down`                    |
 55| Select next                      | Menu           | `Control + N`                  |
 56| Select next                      | Menu           | `Down`                         |
 57| Select prev                      | Menu           | `Control + P`                  |
 58| Select prev                      | Menu           | `Up`                           |
 59| Show context menu                | Menu           | `Control + Enter`              |
 60| Activate next item               | Pane           | `Alt + Command + Right`        |
 61| Activate next item               | Pane           | `Command + }`                  |
 62| Activate prev item               | Pane           | `Alt + Command + Left`         |
 63| Activate prev item               | Pane           | `Command + {`                  |
 64| Close active item                | Pane           | `Command + W`                  |
 65| Close all items                  | Pane           | `Command + K, Command + W`     |
 66| Close clean items                | Pane           | `Command + K, U`               |
 67| Close inactive items             | Pane           | `Alt + Command + T`            |
 68| Open recent                      | Projects       | `Alt + Command + O`            |
 69| Toggle focus                     | Terminal Panel | ``Control + ` ``               |
 70| Activate pane in direction down  | Workspace      | `Command + K, Command + Down`  |
 71| Activate pane in direction left  | Workspace      | `Command + K, Command + Left`  |
 72| Activate pane in direction right | Workspace      | `Command + K, Command + Right` |
 73| Activate pane in direction up    | Workspace      | `Command + K, Command + Up`    |
 74| Close inactive tabs and panes    | Workspace      | `Control + Alt + Command + W`  |
 75| Close window                     | Workspace      | `Command + Shift + W`          |
 76| Follow next collaborator         | Workspace      | `Control + Alt + Command + F`  |
 77| New file                         | Workspace      | `Command + N`                  |
 78| New terminal                     | Workspace      | `Control + ~`                  |
 79| New window                       | Workspace      | `Command + Shift + N`          |
 80| Open                             | Workspace      | `Command + O`                  |
 81| Save                             | Workspace      | `Command + S`                  |
 82| Save as                          | Workspace      | `Command + Shift + S`          |
 83| Swap pane in direction           | Workspace      | `Command + K, Shift + Down`    |
 84| Swap pane in direction           | Workspace      | `Command + K, Shift + Left`    |
 85| Swap pane in direction           | Workspace      | `Command + K, Shift + Right`   |
 86| Swap pane in direction           | Workspace      | `Command + K, Shift + Up`      |
 87| Toggle zoom                      | Workspace      | `Shift + Escape`               |
 88| Debug elements                   | Zed            | `Command + Alt + I`            |
 89| Decrease buffer font size        | Zed            | `Command + `                   |
 90| Hide                             | Zed            | `Command + H`                  |
 91| Hide others                      | Zed            | `Alt + Command + H`            |
 92| Increase buffer font size        | Zed            | `Command + +`                  |
 93| Increase buffer font size        | Zed            | `Command + =`                  |
 94| Minimize                         | Zed            | `Command + M`                  |
 95| Open settings                    | Zed            | `Command + ,`                  |
 96| Quit                             | Zed            | `Command + Q`                  |
 97| Reset buffer font size           | Zed            | `Command + 0`                  |
 98| Toggle full screen               | Zed            | `Control + Command + F`        |
 99
100#### Editor
101
102| **Command**                      | **Target** | **Default Shortcut**                 |
103| -------------------------------- | ---------- | ------------------------------------ |
104| Inline assist                    | Assistant  | `Control + Enter`                    |
105| Add selection above              | Editor     | `Command + Alt + Up`                 |
106| Add selection above              | Editor     | `Command + Control + P`              |
107| Add selection below              | Editor     | `Command + Alt + Down`               |
108| Add selection below              | Editor     | `Command + Control + N`              |
109| Backspace                        | Editor     | `Backspace`                          |
110| Backspace                        | Editor     | `Control + H`                        |
111| Backspace                        | Editor     | `Shift + Backspace`                  |
112| Cancel                           | Editor     | `Escape`                             |
113| Confirm code action              | Editor     | `Enter`                              |
114| Confirm completion               | Editor     | `Enter`                              |
115| Confirm completion               | Editor     | `Tab`                                |
116| Confirm rename                   | Editor     | `Enter`                              |
117| Context menu first               | Editor     | `Page Up`                            |
118| Context menu last                | Editor     | `Page Down`                          |
119| Context menu next                | Editor     | `Control + N`                        |
120| Context menu next                | Editor     | `Down`                               |
121| Context menu prev                | Editor     | `Control + P`                        |
122| Context menu prev                | Editor     | `Up`                                 |
123| Copy                             | Editor     | `Command + C`                        |
124| Cut                              | Editor     | `Command + X`                        |
125| Cut to end of line               | Editor     | `Control + K`                        |
126| Delete                           | Editor     | `Control + D`                        |
127| Delete                           | Editor     | `Delete`                             |
128| Delete line                      | Editor     | `Control + Shift + K`                |
129| Delete to beginning of line      | Editor     | `Command + Backspace`                |
130| Delete to end of line            | Editor     | `Command + Delete`                   |
131| Delete to next subword end       | Editor     | `Control + Alt + D`                  |
132| Delete to next subword end       | Editor     | `Control + Alt + Delete`             |
133| Delete to next word end          | Editor     | `Alt + D`                            |
134| Delete to next word end          | Editor     | `Alt + Delete`                       |
135| Delete to previous subword start | Editor     | `Control + Alt + Backspace`          |
136| Delete to previous subword start | Editor     | `Control + Alt + H`                  |
137| Delete to previous word start    | Editor     | `Alt + Backspace`                    |
138| Delete to previous word start    | Editor     | `Alt + H`                            |
139| Duplicate line                   | Editor     | `Command + Shift + D`                |
140| Find all references              | Editor     | `Alt + Shift + F12`                  |
141| Fold                             | Editor     | `Alt + Command + [`                  |
142| Format                           | Editor     | `Command + Shift + I`                |
143| Go to definition                 | Editor     | `F12`                                |
144| Go to definition split           | Editor     | `Alt + F12`                          |
145| Go to diagnostic                 | Editor     | `F8`                                 |
146| Go to hunk                       | Editor     | `Command + F8`                       |
147| Go to prev diagnostic            | Editor     | `Shift + F8`                         |
148| Go to prev hunk                  | Editor     | `Command + Shift + F8`               |
149| Go to type definition            | Editor     | `Command + F12`                      |
150| Go to type definition split      | Editor     | `Alt + Command + F12`                |
151| Hover                            | Editor     | `Command + K, Command + I`           |
152| Indent                           | Editor     | `Command + ]`                        |
153| Join lines                       | Editor     | `Control + J`                        |
154| Move down                        | Editor     | `Control + N`                        |
155| Move down                        | Editor     | `Down`                               |
156| Move left                        | Editor     | `Control + B`                        |
157| Move left                        | Editor     | `Left`                               |
158| Move line down                   | Editor     | `Control + Command + Down`           |
159| Move line up                     | Editor     | `Control + Command + Up`             |
160| Move page down                   | Editor     | `Control + V`                        |
161| Move page down                   | Editor     | `Shift + Page Down`                  |
162| Move page up                     | Editor     | `Alt + V`                            |
163| Move page up                     | Editor     | `Shift + Page Up`                    |
164| Move right                       | Editor     | `Control + F`                        |
165| Move right                       | Editor     | `Right`                              |
166| Move to beginning                | Editor     | `Command + Up`                       |
167| Move to beginning of line        | Editor     | `Command + Left`                     |
168| Move to beginning of line        | Editor     | `Control + A`                        |
169| Move to beginning of line        | Editor     | `Home`                               |
170| Move to enclosing bracket        | Editor     | `Control + M`                        |
171| Move to end                      | Editor     | `Command + Down`                     |
172| Move to end of line              | Editor     | `Command + Right`                    |
173| Move to end of line              | Editor     | `Control + E`                        |
174| Move to end of line              | Editor     | `End`                                |
175| Move to end of paragraph         | Editor     | `Control + Down`                     |
176| Move to next subword end         | Editor     | `Control + Alt + F`                  |
177| Move to next subword end         | Editor     | `Control + Alt + Right`              |
178| Move to next word end            | Editor     | `Alt + F`                            |
179| Move to next word end            | Editor     | `Alt + Right`                        |
180| Move to previous subword start   | Editor     | `Control + Alt + B`                  |
181| Move to previous subword start   | Editor     | `Control + Alt + Left`               |
182| Move to previous word start      | Editor     | `Alt + B`                            |
183| Move to previous word start      | Editor     | `Alt + Left`                         |
184| Move to start of paragraph       | Editor     | `Control + Up`                       |
185| Move up                          | Editor     | `Control + P`                        |
186| Move up                          | Editor     | `Up`                                 |
187| Next screen                      | Editor     | `Control + L`                        |
188| Open excerpts                    | Editor     | `Alt + Enter`                        |
189| Outdent                          | Editor     | `Command + [`                        |
190| Page down                        | Editor     | `Page Down`                          |
191| Page up                          | Editor     | `Page Up`                            |
192| Paste                            | Editor     | `Command + V`                        |
193| Redo                             | Editor     | `Command + Shift + Z`                |
194| Redo selection                   | Editor     | `Command + Shift + U`                |
195| Rename                           | Editor     | `F2`                                 |
196| Reveal in finder                 | Editor     | `Alt + Command + R`                  |
197| Select all                       | Editor     | `Command + A`                        |
198| Select all matches               | Editor     | `Command + Shift + L`                |
199| Select down                      | Editor     | `Control + Shift + N`                |
200| Select down                      | Editor     | `Shift + Down`                       |
201| Select larger syntax node        | Editor     | `Alt + Up`                           |
202| Select left                      | Editor     | `Control + Shift + B`                |
203| Select left                      | Editor     | `Shift + Left`                       |
204| Select line                      | Editor     | `Command + L`                        |
205| Select next                      | Editor     | `Command + D`                        |
206| Select next                      | Editor     | `Command + K, Command + D`           |
207| Select previous                  | Editor     | `Command + K, Control + Command + D` |
208| Select previous                  | Editor     | `Control + Command + D`              |
209| Select right                     | Editor     | `Control + Shift + F`                |
210| Select right                     | Editor     | `Shift + Right`                      |
211| Select smaller syntax node       | Editor     | `Alt + Down`                         |
212| Select to beginning              | Editor     | `Command + Shift + Up`               |
213| Select to beginning of line      | Editor     | `Command + Shift + Left`             |
214| Select to beginning of line      | Editor     | `Control + Shift + A`                |
215| Select to beginning of line      | Editor     | `Shift + Home`                       |
216| Select to end                    | Editor     | `Command + Shift + Down`             |
217| Select to end of line            | Editor     | `Command + Shift + Right`            |
218| Select to end of line            | Editor     | `Control + Shift + E`                |
219| Select to end of line            | Editor     | `Shift + End`                        |
220| Select to end of paragraph       | Editor     | `Control + Shift + Down`             |
221| Select to next subword end       | Editor     | `Control + Alt + Shift + F`          |
222| Select to next subword end       | Editor     | `Control + Alt + Shift + Right`      |
223| Select to next word end          | Editor     | `Alt + Shift + F`                    |
224| Select to next word end          | Editor     | `Alt + Shift + Right`                |
225| Select to previous subword start | Editor     | `Control + Alt + Shift + B`          |
226| Select to previous subword start | Editor     | `Control + Alt + Shift + Left`       |
227| Select to previous word start    | Editor     | `Alt + Shift + B`                    |
228| Select to previous word start    | Editor     | `Alt + Shift + Left`                 |
229| Select to start of paragraph     | Editor     | `Control + Shift + Up`               |
230| Select up                        | Editor     | `Control + Shift + P`                |
231| Select up                        | Editor     | `Shift + Up`                         |
232| Show character palette           | Editor     | `Control + Command + Space`          |
233| Show completions                 | Editor     | `Control + Space`                    |
234| Tab                              | Editor     | `Tab`                                |
235| Tab prev                         | Editor     | `Shift + Tab`                        |
236| Toggle code actions              | Editor     | `Command + .`                        |
237| Toggle comments                  | Editor     | `Command + /`                        |
238| Transpose                        | Editor     | `Control + T`                        |
239| Undo                             | Editor     | `Command + Z`                        |
240| Undo selection                   | Editor     | `Command + U`                        |
241| Unfold lines                     | Editor     | `Alt + Command + ]`                  |
242
243#### Editor (Full Only)
244
245| **Command**         | **Target**    | **Default Shortcut**      |
246| ------------------- | ------------- | ------------------------- |
247| Quote selection     | Assistant     | `Command + >`             |
248| Deploy              | Buffer Search | `Command + E`             |
249| Deploy              | Buffer Search | `Command + F`             |
250| Next suggestion     | Copilot       | `Alt + ]`                 |
251| Previous suggestion | Copilot       | `Alt + [`                 |
252| Suggest             | Copilot       | `Alt + \`                 |
253| Newline             | Editor        | `Enter`                   |
254| Newline             | Editor        | `Shift + Enter`           |
255| Newline above       | Editor        | `Command + Shift + Enter` |
256| Newline below       | Editor        | `Command + Enter`         |
257| Toggle soft wrap    | Editor        | `Alt + Z`                 |
258| Toggle              | Go To Line    | `Control + G`             |
259| Toggle              | Outline       | `Command + Shift + O`     |
260
261#### Editor (Auto Height Only)
262
263| **Command**   | **Target** | **Default Shortcut**      |
264| ------------- | ---------- | ------------------------- |
265| Newline       | Editor     | `Control + Enter`         |
266| Newline below | Editor     | `Control + Shift + Enter` |
267
268#### Pane
269
270| **Command**            | **Target**     | **Default Shortcut**  |
271| ---------------------- | -------------- | --------------------- |
272| Activate item 1        | Pane           | `Control + 1`         |
273| Activate item 2        | Pane           | `Control + 2`         |
274| Activate item 3        | Pane           | `Control + 3`         |
275| Activate item 4        | Pane           | `Control + 4`         |
276| Activate item 5        | Pane           | `Control + 5`         |
277| Activate item 6        | Pane           | `Control + 6`         |
278| Activate item 7        | Pane           | `Control + 7`         |
279| Activate item 8        | Pane           | `Control + 8`         |
280| Activate item 9        | Pane           | `Control + 9`         |
281| Activate last item     | Pane           | `Control + 0`         |
282| Go back                | Pane           | `Control + `          |
283| Go forward             | Pane           | `Control + _`         |
284| Reopen closed item     | Pane           | `Command + Shift + T` |
285| Split down             | Pane           | `Command + K, Down`   |
286| Split left             | Pane           | `Command + K, Left`   |
287| Split right            | Pane           | `Command + K, Right`  |
288| Split up               | Pane           | `Command + K, Up`     |
289| Toggle filters         | Project Search | `Alt + Command + F`   |
290| Toggle focus           | Project Search | `Command + F`         |
291| Toggle focus           | Project Search | `Command + Shift + F` |
292| Activate regex mode    | Search         | `Alt + Command + G`   |
293| Activate semantic mode | Search         | `Alt + Command + S`   |
294| Activate text mode     | Search         | `Alt + Command + X`   |
295| Cycle mode             | Search         | `Alt + Tab`           |
296| Select all matches     | Search         | `Alt + Enter`         |
297| Select next match      | Search         | `Command + G`         |
298| Select prev match      | Search         | `Command + Shift + G` |
299| Toggle case sensitive  | Search         | `Alt + Command + C`   |
300| Toggle replace         | Search         | `Command + Shift + H` |
301| Toggle whole word      | Search         | `Alt + Command + W`   |
302
303#### Buffer Search Bar
304
305| **Command**            | **Target**    | **Default Shortcut** |
306| ---------------------- | ------------- | -------------------- |
307| Dismiss                | Buffer Search | `Escape`             |
308| Focus editor           | Buffer Search | `Tab`                |
309| Cycle mode             | Search        | `Alt + Tab`          |
310| Next history query     | Search        | `Down`               |
311| Previous history query | Search        | `Up`                 |
312| Replace all            | Search        | `Command + Enter`    |
313| Replace next           | Search        | `Enter`              |
314| Select all matches     | Search        | `Alt + Enter`        |
315| Select next match      | Search        | `Enter`              |
316| Select prev match      | Search        | `Shift + Enter`      |
317
318#### Workspace
319
320| **Command**        | **Target**        | **Default Shortcut**       |
321| ------------------ | ----------------- | -------------------------- |
322| Toggle focus       | Assistant         | `Command + ?`              |
323| Toggle             | Command Palette   | `Command + Shift + P`      |
324| Deploy             | Diagnostics       | `Command + Shift + M`      |
325| Toggle             | File Finder       | `Command + P`              |
326| Toggle             | Language Selector | `Command + K, M`           |
327| Toggle focus       | Project Panel     | `Command + Shift + E`      |
328| Toggle             | Project Symbols   | `Command + T`              |
329| Toggle             | Theme Selector    | `Command + K, Command + T` |
330| Activate pane 1    | Workspace         | `Command + 1`              |
331| Activate pane 2    | Workspace         | `Command + 2`              |
332| Activate pane 3    | Workspace         | `Command + 3`              |
333| Activate pane 4    | Workspace         | `Command + 4`              |
334| Activate pane 5    | Workspace         | `Command + 5`              |
335| Activate pane 6    | Workspace         | `Command + 6`              |
336| Activate pane 7    | Workspace         | `Command + 7`              |
337| Activate pane 8    | Workspace         | `Command + 8`              |
338| Activate pane 9    | Workspace         | `Command + 9`              |
339| Close all docks    | Workspace         | `Alt + Command + Y`        |
340| New search         | Workspace         | `Command + Shift + F`      |
341| Save all           | Workspace         | `Command + Alt + S`        |
342| Toggle bottom dock | Workspace         | `Command + J`              |
343| Toggle left dock   | Workspace         | `Command + B`              |
344| Toggle right dock  | Workspace         | `Command + R`              |
345| Open keymap        | Zed               | `Command + K, Command + S` |
346
347#### Project Panel
348
349| **Command**             | **Target**    | **Default Shortcut**        |
350| ----------------------- | ------------- | --------------------------- |
351| Collapse selected entry | Project Panel | `Left`                      |
352| Copy                    | Project Panel | `Command + C`               |
353| Copy path               | Project Panel | `Command + Alt + C`         |
354| Copy relative path      | Project Panel | `Alt + Command + Shift + C` |
355| Cut                     | Project Panel | `Command + X`               |
356| Delete                  | Project Panel | `Backspace`                 |
357| Expand selected entry   | Project Panel | `Right`                     |
358| New directory           | Project Panel | `Alt + Command + N`         |
359| New file                | Project Panel | `Command + N`               |
360| New search in directory | Project Panel | `Alt + Shift + F`           |
361| Open                    | Project Panel | `Space`                     |
362| Paste                   | Project Panel | `Command + V`               |
363| Rename                  | Project Panel | `Enter`                     |
364| Rename                  | Project Panel | `F2`                        |
365| Reveal in finder        | Project Panel | `Alt + Command + R`         |
366
367#### Project Search Bar
368
369| **Command**            | **Target**     | **Default Shortcut**  |
370| ---------------------- | -------------- | --------------------- |
371| Search in new          | Project Search | `Command + Enter`     |
372| Toggle focus           | Project Search | `Escape`              |
373| Activate regex mode    | Search         | `Alt + Command + G`   |
374| Activate semantic mode | Search         | `Alt + Command + S`   |
375| Activate text mode     | Search         | `Alt + Command + X`   |
376| Cycle mode             | Search         | `Alt + Tab`           |
377| Next history query     | Search         | `Down`                |
378| Previous history query | Search         | `Up`                  |
379| Replace all            | Search         | `Command + Enter`     |
380| Replace next           | Search         | `Enter`               |
381| Toggle replace         | Search         | `Command + Shift + H` |
382
383#### Terminal
384
385| **Command**                 | **Target** | **Default Shortcut**        |
386| --------------------------- | ---------- | --------------------------- |
387| Clear                       | Terminal   | `Command + K`               |
388| Copy                        | Terminal   | `Command + C`               |
389| Delete line                 | Terminal   | `Command + Backspace`       |
390| Move to beginning of line   | Terminal   | `Command + Left`            |
391| Move to end of line         | Terminal   | `Command + Right`           |
392| Move to next word end       | Terminal   | `Alt + Right`               |
393| Move to previous word start | Terminal   | `Alt + Left`                |
394| Paste                       | Terminal   | `Command + V`               |
395| Show character palette      | Terminal   | `Control + Command + Space` |
396
397#### Assistant Editor
398
399| **Command**        | **Target** | **Default Shortcut** |
400| ------------------ | ---------- | -------------------- |
401| Assist             | Assistant  | `Command + Enter`    |
402| Cycle message role | Assistant  | `Control + R`        |
403| Quote selection    | Assistant  | `Command + >`        |
404| Split              | Assistant  | `Shift + Enter`      |
405| Save               | Workspace  | `Command + S`        |