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 [zed repository's keymaps folder](https://github.com/zed-industries/zed/tree/main/assets/keymaps).
6
7## Custom key bindings
8
9### Accessing custom key bindings
10
11You can open `keymap.json` via `⌘` + `K`, `⌘` + `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` + `⌘` + `B` |
43| Toggle focus | Collab Panel | `⌘` + `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 | `⌘` + `Enter` |
49| Select first | Menu | `⌘` + `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 | `⌘` + `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` + `⌘` + `Right` |
61| Activate next item | Pane | `⌘` + `}` |
62| Activate prev item | Pane | `Alt` + `⌘` + `Left` |
63| Activate prev item | Pane | `⌘` + `{` |
64| Close active item | Pane | `⌘` + `W` |
65| Close all items | Pane | `⌘` + `K`, `⌘` + `W` |
66| Close clean items | Pane | `⌘` + `K`, `U` |
67| Close inactive items | Pane | `Alt` + `⌘` + `T` |
68| Open recent | Projects | `Alt` + `⌘` + `O` |
69| Toggle focus | Terminal Panel | `Control` + `` ` `` |
70| Activate pane in direction down | Workspace | `⌘` + `K`, `⌘` + `Down` |
71| Activate pane in direction left | Workspace | `⌘` + `K`, `⌘` + `Left` |
72| Activate pane in direction right | Workspace | `⌘` + `K`, `⌘` + `Right` |
73| Activate pane in direction up | Workspace | `⌘` + `K`, `⌘` + `Up` |
74| Close inactive tabs and panes | Workspace | `Control` + `Alt` + `⌘` + `W` |
75| Close window | Workspace | `⌘` + `Shift` + `W` |
76| Follow next collaborator | Workspace | `Control` + `Alt` + `⌘` + `F` |
77| New file | Workspace | `⌘` + `N` |
78| New terminal | Workspace | `Control` + `~` |
79| New window | Workspace | `⌘` + `Shift` + `N` |
80| Open | Workspace | `⌘` + `O` |
81| Save | Workspace | `⌘` + `S` |
82| Save as | Workspace | `⌘` + `Shift` + `S` |
83| Swap pane in direction | Workspace | `⌘` + `K`, `Shift` + `Down` |
84| Swap pane in direction | Workspace | `⌘` + `K`, `Shift` + `Left` |
85| Swap pane in direction | Workspace | `⌘` + `K`, `Shift` + `Right` |
86| Swap pane in direction | Workspace | `⌘` + `K`, `Shift` + `Up` |
87| Toggle zoom | Workspace | `Shift` + `Escape` |
88| Debug elements | Zed | `⌘` + `Alt` + `I` |
89| Decrease buffer font size | Zed | `⌘` + `` ` `` |
90| Hide | Zed | `⌘` + `H` |
91| Hide others | Zed | `Alt` + `⌘` + `H` |
92| Increase buffer font size | Zed | `⌘` + `+` |
93| Increase buffer font size | Zed | `⌘` + `=` |
94| Minimize | Zed | `⌘` + `M` |
95| Open settings | Zed | `⌘` + `,` |
96| Quit | Zed | `⌘` + `Q` |
97| Reset buffer font size | Zed | `⌘` + `0` |
98| Toggle full screen | Zed | `Control` + `⌘` + `F` |
99
100### Editor
101
102| **Command** | **Target** | **Default Shortcut** |
103| -------------------------------- | ---------- | ------------------------------------- |
104| Inline assist | Assistant | `Control` + `Enter` |
105| Add selection above | Editor | `⌘` + `Alt` + `Up` |
106| Add selection above | Editor | `⌘` + `Control` + `P` |
107| Add selection below | Editor | `⌘` + `Alt` + `Down` |
108| Add selection below | Editor | `⌘` + `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 | `⌘` + `C` |
124| Cut | Editor | `⌘` + `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 | `⌘` + `Backspace` |
130| Delete to end of line | Editor | `⌘` + `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 | `⌘` + `Shift` + `D` |
140| Find all references | Editor | `Alt` + `Shift` + `F12` |
141| Fold | Editor | `Alt` + `⌘` + `[` |
142| Format | Editor | `⌘` + `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 | `⌘` + `F8` |
147| Go to prev diagnostic | Editor | `Shift` + `F8` |
148| Go to prev hunk | Editor | `⌘` + `Shift` + `F8` |
149| Go to type definition | Editor | `⌘` + `F12` |
150| Go to type definition split | Editor | `Alt` + `⌘` + `F12` |
151| Hover | Editor | `⌘` + `K`, `⌘` + `I` |
152| Indent | Editor | `⌘` + `]` |
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` + `⌘` + `Down` |
159| Move line up | Editor | `Control` + `⌘` + `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 | `⌘` + `Up` |
167| Move to beginning of line | Editor | `⌘` + `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 | `⌘` + `Down` |
172| Move to end of line | Editor | `⌘` + `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 | `⌘` + `[` |
190| Page down | Editor | `Page Down` |
191| Page up | Editor | `Page Up` |
192| Paste | Editor | `⌘` + `V` |
193| Redo | Editor | `⌘` + `Shift` + `Z` |
194| Redo selection | Editor | `⌘` + `Shift` + `U` |
195| Rename | Editor | `F2` |
196| Reveal in finder | Editor | `Alt` + `⌘` + `R` |
197| Select all | Editor | `⌘` + `A` |
198| Select all matches | Editor | `⌘` + `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 | `⌘` + `L` |
205| Select next | Editor | `⌘` + `D` |
206| Select next | Editor | `⌘` + `K`, `⌘` + `D` |
207| Select previous | Editor | `⌘` + `K`, `Control` + `⌘` + `D` |
208| Select previous | Editor | `Control` + `⌘` + `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 | `⌘` + `Shift` + `Up` |
213| Select to beginning of line | Editor | `⌘` + `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 | `⌘` + `Shift` + `Down` |
217| Select to end of line | Editor | `⌘` + `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` + `⌘` + `Space` |
233| Show completions | Editor | `Control` + `Space` |
234| Tab | Editor | `Tab` |
235| Tab prev | Editor | `Shift` + `Tab` |
236| Toggle code actions | Editor | `⌘` + `.` |
237| Toggle comments | Editor | `⌘` + `/` |
238| Transpose | Editor | `Control` + `T` |
239| Undo | Editor | `⌘` + `Z` |
240| Undo selection | Editor | `⌘` + `U` |
241| Unfold lines | Editor | `Alt` + `⌘` + `]` |
242
243### Editor (Full Only)
244
245| **Command** | **Target** | **Default Shortcut** |
246| ------------------- | ------------- | ----------------------- |
247| Quote selection | Assistant | `⌘` + `>` |
248| Deploy | Buffer Search | `⌘` + `E` |
249| Deploy | Buffer Search | `⌘` + `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 | `⌘` + `Shift` + `Enter` |
256| Newline below | Editor | `⌘` + `Enter` |
257| Toggle soft wrap | Editor | `Alt` + `Z` |
258| Toggle | Go To Line | `Control` + `G` |
259| Toggle | Outline | `⌘` + `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 | `⌘` + `Shift` + `T` |
285| Split down | Pane | `⌘` + `K`, `Down` |
286| Split left | Pane | `⌘` + `K`, `Left` |
287| Split right | Pane | `⌘` + `K`, `Right` |
288| Split up | Pane | `⌘` + `K`, `Up` |
289| Toggle filters | Project Search | `Alt` + `⌘` + `F` |
290| Toggle focus | Project Search | `⌘` + `F` |
291| Toggle focus | Project Search | `⌘` + `Shift` + `F` |
292| Activate regex mode | Search | `Alt` + `⌘` + `G` |
293| Activate semantic mode | Search | `Alt` + `⌘` + `S` |
294| Activate text mode | Search | `Alt` + `⌘` + `X` |
295| Cycle mode | Search | `Alt` + `Tab` |
296| Select all matches | Search | `Alt` + `Enter` |
297| Select next match | Search | `⌘` + `G` |
298| Select prev match | Search | `⌘` + `Shift` + `G` |
299| Toggle case sensitive | Search | `Alt` + `⌘` + `C` |
300| Toggle replace | Search | `⌘` + `Shift` + `H` |
301| Toggle whole word | Search | `Alt` + `⌘` + `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 | `⌘` + `?` |
323| Toggle | Command Palette | `⌘` + `Shift` + `P` |
324| Deploy | Diagnostics | `⌘` + `Shift` + `M` |
325| Toggle | File Finder | `⌘` + `P` |
326| Toggle | Language Selector | `⌘` + `K`, `M` |
327| Toggle focus | Project Panel | `⌘` + `Shift` + `E` |
328| Toggle | Project Symbols | `⌘` + `T` |
329| Toggle | Theme Selector | `⌘` + `K`, `⌘` + `T` |
330| Activate pane 1 | Workspace | `⌘` + `1` |
331| Activate pane 2 | Workspace | `⌘` + `2` |
332| Activate pane 3 | Workspace | `⌘` + `3` |
333| Activate pane 4 | Workspace | `⌘` + `4` |
334| Activate pane 5 | Workspace | `⌘` + `5` |
335| Activate pane 6 | Workspace | `⌘` + `6` |
336| Activate pane 7 | Workspace | `⌘` + `7` |
337| Activate pane 8 | Workspace | `⌘` + `8` |
338| Activate pane 9 | Workspace | `⌘` + `9` |
339| Close all docks | Workspace | `Alt` + `⌘` + `Y` |
340| New search | Workspace | `⌘` + `Shift` + `F` |
341| Save all | Workspace | `⌘` + `Alt` + `S` |
342| Toggle bottom dock | Workspace | `⌘` + `J` |
343| Toggle left dock | Workspace | `⌘` + `B` |
344| Toggle right dock | Workspace | `⌘` + `R` |
345| Open keymap | Zed | `⌘` + `K`, `⌘` + `S` |
346
347### Project Panel
348
349| **Command** | **Target** | **Default Shortcut** |
350| ----------------------- | ------------- | --------------------------- |
351| Collapse selected entry | Project Panel | `Left` |
352| Copy | Project Panel | `⌘` + `C` |
353| Copy path | Project Panel | `⌘` + `Alt` + `C` |
354| Copy relative path | Project Panel | `Alt` + `⌘` + `Shift` + `C` |
355| Cut | Project Panel | `⌘` + `X` |
356| Delete | Project Panel | `Backspace` |
357| Expand selected entry | Project Panel | `Right` |
358| New directory | Project Panel | `Alt` + `⌘` + `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 | `⌘` + `V` |
363| Rename | Project Panel | `Enter` |
364| Rename | Project Panel | `F2` |
365| Reveal in finder | Project Panel | `Alt` + `⌘` + `R` |
366
367### Project Search Bar
368
369| **Command** | **Target** | **Default Shortcut** |
370| ---------------------- | -------------- | -------------------- |
371| Search in new | Project Search | `⌘` + `Enter` |
372| Toggle focus | Project Search | `Escape` |
373| Activate regex mode | Search | `Alt` + `⌘` + `G` |
374| Activate semantic mode | Search | `Alt` + `⌘` + `S` |
375| Activate text mode | Search | `Alt` + `⌘` + `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 | `⌘` + `Shift` + `H` |
382
383### Terminal
384
385| **Command** | **Target** | **Default Shortcut** |
386| --------------------------- | ---------- | ------------------------- |
387| Clear | Terminal | `⌘` + `K` |
388| Copy | Terminal | `⌘` + `C` |
389| Delete line | Terminal | `⌘` + `Backspace` |
390| Move to beginning of line | Terminal | `⌘` + `Left` |
391| Move to end of line | Terminal | `⌘` + `Right` |
392| Move to next word end | Terminal | `Alt` + `Right` |
393| Move to previous word start | Terminal | `Alt` + `Left` |
394| Paste | Terminal | `⌘` + `V` |
395| Show character palette | Terminal | `Control` + `⌘` + `Space` |
396
397### Assistant Editor
398
399| **Command** | **Target** | **Default Shortcut** |
400| ------------------ | ---------- | -------------------- |
401| Assist | Assistant | `⌘` + `Enter` |
402| Cycle message role | Assistant | `Control` + `R` |
403| Quote selection | Assistant | `⌘` + `>` |
404| Split | Assistant | `Shift` + `Enter` |
405| Save | Workspace | `⌘` + `S` |