Key bindings

Zed can be configured via a simple JSON file located at ~/.config/zed/keymap.json.

Predefined keymaps

We have a growing collection of pre-defined keymaps in zed repository's keymaps folder.

Custom key bindings

Accessing custom key bindings

You can open keymap.json via + K, + S, the command palette, or the Zed > Settings > Open Key Bindings application menu item.

Adding a custom key binding

To 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.

An example of adding a set of custom key bindings:

[
    {
        "context": "Editor",
        "bindings": {
            "ctrl-w": "editor::SelectLargerSyntaxNode",
            "ctrl-shift-W": "editor::SelectSmallerSyntaxNode",
            "ctrl-c": "editor::Cancel"
        }
    }
]

You can see more examples in Zed's default.json

There are some key bindings that can't be overridden; we are working on an issue surrounding this.

Keybinding syntax

Zed has the ability to match against not just a single keypress, but a sequence of keys typed in order. Each key in the "bindings" map is a sequence of keypresses separated with a space.

Each key press is a sequence of modifiers followed by a key. The modifiers are:

  • ctrl- The control key
  • cmd- On macOS, this is the command key
  • alt- On macOS, this is the option key
  • shift- The shift key
  • fn- The function key

The keys can be any single unicode codepoint that your keyboard generates (for example a, 0, £ or ç).

A few examples:

 "bindings": {
   "cmd-k cmd-s": "zed::OpenKeyMap", // matches ⌘-k then ⌘-s
   "space e": "editor::Complete", // type space then e
   "ç": "editor::Complete", // matches ⌥-c
 }

NOTE: Keys on a keyboard are not always the same as the character they generate. For example shift-e actually types E (or alt-c types ç). Zed allows you to match against either the key and its modifiers or the character it generates. This means you can specify alt-c or ç, but not alt-ç. It is usually better to specify the key and its modifiers, as this will work better on different keyboard layouts.

Remapping keys

A common request is to be able to map from one sequence of keys to another. As of Zed 0.124.0 you can do this with the workspace::SendKeystrokes action.

[
    {
        "bindings": {
            "j k": ["workspace::SendKeystrokes", "escape"],
            "alt-down": ["workspace::SendKeystrokes", "down down down down"],
            "cmd-alt-c": [
                "workspace::SendKeystrokes",
                "cmd-shift-p copy relative path enter"
            ],
            "cmd-alt-r": ["workspace::SendKeystrokes", "cmd-p README enter"]
        }
    }
]

There are some limitations to this, notably:

  • Any asyncronous operation will not happen until after all your key bindings have been dispatched. For example this means that while you can use a binding to open a file (as in the cmd-alt-r example) you cannot send further keystrokes and hope to have them interpretted by the new view.
    • Other examples of asynchronous things are: communicating with a language server, changing the language of a buffer, anything that hits the network.
  • There is a limit of 100 simulated keys at a time, this is to avoid accidental infinite recursion if you trigger SendKeystrokes again inside your bindings.

The argument to SendKeystrokes is a space-separated list of keystrokes (using the same syntax as above). Due to the way that keystrokes are parsed, any segment that is not recognized as a keypress will be sent verbatim to the currently focused input field.

All key bindings

Global

CommandTargetDefault Shortcut
Toggle focusCollab Panel⌘ + Shift + C
Toggle inlay hintsEditorControl + :
CancelMenuControl + C
CancelMenuEscape
ConfirmMenuEnter
Secondary confirmMenu⌘ + Enter
Select firstMenuPage Up
Select firstMenuShift + Page Down
Select firstMenuShift + Page Up
Select firstMenu⌘ + Up
Select lastMenuPage Down
Select lastMenu⌘ + Down
Select nextMenuControl + N
Select nextMenuDown
Select prevMenuControl + P
Select prevMenuUp
Show context menuMenuControl + Enter
Use selected queryMenuShift + Enter
Close windowWorkspace⌘ + Shift + W
Follow next collaboratorWorkspaceControl + Alt + ⌘ + F
OpenWorkspace⌘ + O
Toggle zoomWorkspaceShift + Escape
Debug elementsZed⌘ + Alt + I
Decrease buffer font sizeZed⌘ +
HideZed⌘ + H
Hide othersZedAlt + ⌘ + H
Increase buffer font sizeZed⌘ + +
Increase buffer font sizeZed⌘ + =
MinimizeZed⌘ + M
Open settingsZed⌘ + ,
QuitZed⌘ + Q
Reset buffer font sizeZed⌘ + 0
Toggle full screenZedControl + ⌘ + F

Editor

CommandTargetDefault Shortcut
SuggestCopilotAlt + \
Add selection aboveEditor⌘ + Alt + Up
Add selection aboveEditor⌘ + Control + P
Add selection belowEditor⌘ + Alt + Down
Add selection belowEditor⌘ + Control + N
BackspaceEditorBackspace
BackspaceEditorControl + H
BackspaceEditorShift + Backspace
CancelEditorEscape
Confirm code actionEditorEnter
Confirm completionEditorEnter
Confirm completionEditorTab
Confirm renameEditorEnter
Context menu firstEditorPage Up
Context menu lastEditorPage Down
Context menu nextEditorControl + N
Context menu nextEditorDown
Context menu prevEditorControl + P
Context menu prevEditorUp
CopyEditor⌘ + C
CutEditor⌘ + X
Cut to end of lineEditorControl + K
DeleteEditorControl + D
DeleteEditorDelete
Delete lineEditor⌘ + Shift + K
Delete to beginning of lineEditor⌘ + Backspace
Delete to end of lineEditor⌘ + Delete
Delete to next subword endEditorControl + Alt + D
Delete to next subword endEditorControl + Alt + Delete
Delete to next word endEditorAlt + D
Delete to next word endEditorAlt + Delete
Delete to previous subword startEditorControl + Alt + Backspace
Delete to previous subword startEditorControl + Alt + H
Delete to previous word startEditorAlt + Backspace
Delete to previous word startEditorAlt + H
Delete to previous word startEditorControl + W
Display cursor namesEditorControl + ⌘ + C
Duplicate lineEditorAlt + Shift + Down
Duplicate lineEditorAlt + Shift + Up
Find all referencesEditorAlt + Shift + F12
FoldEditorAlt + ⌘ + [
FormatEditor⌘ + Shift + I
Go to definitionEditorF12
Go to definition splitEditorAlt + F12
Go to diagnosticEditorF8
Go to prev diagnosticEditorShift + F8
Go to type definitionEditor⌘ + F12
Go to type definition splitEditorAlt + ⌘ + F12
HoverEditor⌘ + K, ⌘ + I
IndentEditor⌘ + ]
Join linesEditorControl + J
Move downEditorControl + N
Move downEditorDown
Move leftEditorControl + B
Move leftEditorLeft
Move line downEditorAlt + Down
Move line upEditorAlt + Up
Move page downEditorControl + V
Move page downEditorShift + Page Down
Move page upEditorAlt + V
Move page upEditorShift + Page Up
Move rightEditorControl + F
Move rightEditorRight
Move to beginningEditor⌘ + Up
Move to beginning of lineEditorControl + A
Move to beginning of lineEditorHome
Move to beginning of lineEditor⌘ + Left
Move to enclosing bracketEditorControl + M
Move to endEditor⌘ + Down
Move to end of lineEditorControl + E
Move to end of lineEditorEnd
Move to end of lineEditor⌘ + Right
Move to end of paragraphEditorControl + Down
Move to next subword endEditorControl + Alt + F
Move to next subword endEditorControl + Alt + Right
Move to next word endEditorAlt + F
Move to next word endEditorAlt + Right
Move to previous subword startEditorControl + Alt + B
Move to previous subword startEditorControl + Alt + Left
Move to previous word startEditorAlt + B
Move to previous word startEditorAlt + Left
Move to start of paragraphEditorControl + Up
Move upEditorControl + P
Move upEditorUp
Next screenEditorControl + L
OutdentEditor⌘ + [
Page downEditorPage Down
Page upEditorPage Up
PasteEditor⌘ + V
RedoEditor⌘ + Shift + Z
Redo selectionEditor⌘ + Shift + U
RenameEditorF2
Reveal in finderEditorAlt + ⌘ + R
Revert selected hunksEditor⌘ + Alt + Z
Select allEditor⌘ + A
Select all matchesEditor⌘ + Shift + L
Select downEditorControl + Shift + N
Select downEditorShift + Down
Select larger syntax nodeEditorControl + Shift + Right
Select leftEditorControl + Shift + B
Select leftEditorShift + Left
Select lineEditor⌘ + L
Select nextEditor⌘ + D
Select nextEditor⌘ + K, ⌘ + D
Select previousEditorControl + ⌘ + D
Select previousEditor⌘ + K, Control + ⌘ + D
Select rightEditorControl + Shift + F
Select rightEditorShift + Right
Select smaller syntax nodeEditorControl + Shift + Left
Select to beginningEditor⌘ + Shift + Up
Select to beginning of lineEditorControl + Shift + A
Select to beginning of lineEditorShift + Home
Select to beginning of lineEditor⌘ + Shift + Left
Select to endEditor⌘ + Shift + Down
Select to end of lineEditorControl + Shift + E
Select to end of lineEditorShift + End
Select to end of lineEditor⌘ + Shift + Right
Select to end of paragraphEditorControl + Shift + Down
Select to next subword endEditorControl + Alt + Shift + F
Select to next subword endEditorControl + Alt + Shift + Right
Select to next word endEditorAlt + Shift + F
Select to next word endEditorAlt + Shift + Right
Select to previous subword startEditorControl + Alt + Shift + B
Select to previous subword startEditorControl + Alt + Shift + Left
Select to previous word startEditorAlt + Shift + B
Select to previous word startEditorAlt + Shift + Left
Select to start of paragraphEditorControl + Shift + Up
Select upEditorControl + Shift + P
Select upEditorShift + Up
Show character paletteEditorControl + ⌘ + Space
Show completionsEditorControl + Space
TabEditorTab
Tab prevEditorShift + Tab
Toggle code actionsEditor⌘ + .
Toggle commentsEditor⌘ + /
Toggle line numbersEditor⌘ + ;
TransposeEditorControl + T
UndoEditor⌘ + Z
Undo selectionEditor⌘ + U
Unfold linesEditorAlt + ⌘ + ]

Editor (Full Only)

CommandTargetDefault Shortcut
Inline assistAssistantControl + Enter
Quote selectionAssistant⌘ + >
DeployBuffer Search⌘ + E
DeployBuffer Search⌘ + F
Next suggestionCopilotAlt + ]
Previous suggestionCopilotAlt + [
Accept partial copilot suggestionEditorAlt + Right
Go to hunkEditor⌘ + F8
Go to prev hunkEditor⌘ + Shift + F8
NewlineEditorEnter
NewlineEditorShift + Enter
Newline aboveEditor⌘ + Shift + Enter
Newline belowEditor⌘ + Enter
Open excerptsEditorAlt + Enter
Open excerpts splitEditor⌘ + K, Enter
Toggle soft wrapEditorAlt + Z
ToggleGo To LineControl + G
ToggleOutline⌘ + Shift + O

Editor (Auto Height Only)

CommandTargetDefault Shortcut
NewlineEditorControl + Enter
NewlineEditorShift + Enter
Newline belowEditorControl + Shift + Enter

Pane

CommandTargetDefault Shortcut
Activate item 1PaneControl + 1
Activate item 2PaneControl + 2
Activate item 3PaneControl + 3
Activate item 4PaneControl + 4
Activate item 5PaneControl + 5
Activate item 6PaneControl + 6
Activate item 7PaneControl + 7
Activate item 8PaneControl + 8
Activate item 9PaneControl + 9
Activate last itemPaneControl + 0
Activate next itemPaneAlt + ⌘ + Right
Activate next itemPane⌘ + }
Activate prev itemPaneAlt + ⌘ + Left
Activate prev itemPane⌘ + {
Close active itemPane⌘ + W
Close all itemsPane⌘ + K, ⌘ + W
Close clean itemsPane⌘ + K, U
Close inactive itemsPaneAlt + ⌘ + T
Go backPaneControl +
Go forwardPaneControl + _
Reopen closed itemPane⌘ + Shift + T
Split downPane⌘ + K, Down
Split leftPane⌘ + K, Left
Split rightPane⌘ + K, Right
Split upPane⌘ + K, Up
Toggle filtersProject SearchAlt + ⌘ + F
Toggle focusProject Search⌘ + F
Toggle focusProject Search⌘ + Shift + F
Activate regex modeSearchAlt + ⌘ + G
Activate semantic modeSearchAlt + ⌘ + S
Activate text modeSearchAlt + ⌘ + X
Cycle modeSearchAlt + Tab
Select all matchesSearchAlt + Enter
Select next matchSearch⌘ + G
Select prev matchSearch⌘ + Shift + G
Toggle case sensitiveSearchAlt + ⌘ + C
Toggle replaceSearch⌘ + Shift + H
Toggle whole wordSearchAlt + ⌘ + W
Close inactive tabs and panesWorkspaceControl + Alt + ⌘ + W
CommandTargetDefault Shortcut
DismissBuffer SearchEscape
Focus editorBuffer SearchTab
Cycle modeSearchAlt + Tab
Next history querySearchDown
Previous history querySearchUp
Replace allSearch⌘ + Enter
Replace nextSearchEnter
Select all matchesSearchAlt + Enter
Select next matchSearchEnter
Select prev matchSearchShift + Enter

Workspace

CommandTargetDefault Shortcut
Toggle focusAssistant⌘ + ?
Open recentBranchesAlt + ⌘ + B
ToggleCommand Palette⌘ + Shift + P
DeployDiagnostics⌘ + Shift + M
ToggleFile Finder⌘ + P
ToggleLanguage Selector⌘ + K, M
Deploy searchPane⌘ + Shift + F
Toggle focusProject Panel⌘ + Shift + E
ToggleProject Symbols⌘ + T
Open recentProjectsAlt + ⌘ + O
RerunTaskAlt + T
SpawnTaskAlt + Shift + T
Toggle focusTerminal PanelControl + `
ToggleTheme Selector⌘ + K, ⌘ + T
Activate pane 1Workspace⌘ + 1
Activate pane 2Workspace⌘ + 2
Activate pane 3Workspace⌘ + 3
Activate pane 4Workspace⌘ + 4
Activate pane 5Workspace⌘ + 5
Activate pane 6Workspace⌘ + 6
Activate pane 7Workspace⌘ + 7
Activate pane 8Workspace⌘ + 8
Activate pane 9Workspace⌘ + 9
Activate pane in direction downWorkspace⌘ + K, ⌘ + Down
Activate pane in direction leftWorkspace⌘ + K, ⌘ + Left
Activate pane in direction rightWorkspace⌘ + K, ⌘ + Right
Activate pane in direction upWorkspace⌘ + K, ⌘ + Up
Close all docksWorkspaceAlt + ⌘ + Y
New fileWorkspace⌘ + N
New terminalWorkspaceControl + ~
New windowWorkspace⌘ + Shift + N
SaveWorkspace⌘ + S
Save allWorkspace⌘ + Alt + S
Save asWorkspace⌘ + Shift + S
Save without formatWorkspace⌘ + K, S
Swap pane in directionWorkspace⌘ + K, Shift + Down
Swap pane in directionWorkspace⌘ + K, Shift + Left
Swap pane in directionWorkspace⌘ + K, Shift + Right
Swap pane in directionWorkspace⌘ + K, Shift + Up
Toggle bottom dockWorkspace⌘ + J
Toggle left dockWorkspace⌘ + B
Toggle right dockWorkspace⌘ + R
UnfollowWorkspaceEscape
Open keymapZed⌘ + K, ⌘ + S

Project Panel

CommandTargetDefault Shortcut
Collapse selected entryProject PanelLeft
CopyProject Panel⌘ + C
Copy pathProject Panel⌘ + Alt + C
Copy relative pathProject PanelAlt + ⌘ + Shift + C
CutProject Panel⌘ + X
DeleteProject PanelDelete
DeleteProject Panel⌘ + Backspace
Expand selected entryProject PanelRight
New directoryProject PanelAlt + ⌘ + N
New fileProject Panel⌘ + N
New search in directoryProject PanelAlt + Shift + F
OpenProject PanelSpace
PasteProject Panel⌘ + V
RenameProject PanelEnter
RenameProject PanelF2
Reveal in finderProject PanelAlt + ⌘ + R
CommandTargetDefault Shortcut
Search in newProject Search⌘ + Enter
Toggle focusProject SearchEscape
Activate regex modeSearchAlt + ⌘ + G
Activate semantic modeSearchAlt + ⌘ + S
Activate text modeSearchAlt + ⌘ + X
Cycle modeSearchAlt + Tab
Next history querySearchDown
Previous history querySearchUp
Replace allSearch⌘ + Enter
Replace nextSearchEnter
Toggle replaceSearch⌘ + Shift + H

Terminal

CommandTargetDefault Shortcut
ClearTerminal⌘ + K
CopyTerminal⌘ + C
Delete lineTerminal⌘ + Backspace
Move to beginning of lineTerminal⌘ + Left
Move to end of lineTerminal⌘ + Right
Move to next word endTerminalAlt + Right
Move to previous word startTerminalAlt + Left
PasteTerminal⌘ + V
Show character paletteTerminalControl + ⌘ + Space

Assistant Editor

CommandTargetDefault Shortcut
AssistAssistant⌘ + Enter
Cycle message roleAssistantControl + R
Quote selectionAssistant⌘ + >
SplitAssistantShift + Enter
SaveWorkspace⌘ + S