← Back to DevBytes

Zed Keyboard Shortcuts: Complete Guide

Zed Keyboard Shortcuts: Complete Guide

Zed is a high-performance, GPU-accelerated code editor built in Rust by the creators of Atom. One of its standout features is its keyboard-first philosophy, borrowed heavily from Vim, VS Code, and Sublime Text. Mastering Zed's keyboard shortcuts is essential for any developer who wants to work at the speed of thought.

What Are Zed Keyboard Shortcuts?

Zed keyboard shortcuts are key combinations that trigger editor actions without requiring mouse interaction. They are defined in a JSON-based keymap file and can be fully customized. Zed ships with default keymaps for macOS, Linux, and Windows, and supports multiple preset styles including Default, JetBrains, Sublime Text, and Vim.

Shortcuts in Zed are organized into contexts. A shortcut like cmd-t may behave differently depending on whether you are in the editor pane, the project panel, or the terminal. This context-aware system makes Zed's keymap both powerful and flexible.

Why Keyboard Shortcuts Matter

Every time you reach for your mouse, you break flow. Studies on developer productivity consistently show that keyboard-centric workflows reduce context switching and improve focus. Zed was designed with this principle in mind. By learning the shortcuts, you unlock:

Getting Started With the Keymap System

Opening Your Keymap File

Zed stores user keybindings in a JSON file. To open it, use the command palette:

cmd-shift-p  ->  Open Keymap File

On Linux and Windows, replace cmd with ctrl. The file is typically located at:

~/.config/zed/keymap.json

Any changes you make to this file are applied instantly. There is no need to restart the editor.

Understanding Keymap Syntax

Zed keymaps are written as a JSON array of objects. Each object binds a keystroke to an action within a context. Here is a minimal example:

[
  {
    "context": "Editor",
    "bindings": {
      "cmd-shift-up": "editor::AddSelectionAbove",
      "cmd-shift-down": "editor::AddSelectionBelow"
    }
  }
]

The context field determines where the binding is active. Common contexts include Editor, Workspace, Terminal, ProjectPanel, and Pane. The bindings object maps key combinations to Zed actions.

Core Navigation Shortcuts

File Navigation

The fastest way to move between files is the file finder:

cmd-t          Open file by name (fuzzy search)
cmd-shift-p    Open command palette
cmd-p          Open file in current project
cmd-b          Jump to symbol under cursor (go to definition)
cmd-shift-o    Jump to symbol in current file

Once you have navigated between files, you can move back and forward through your navigation history:

ctrl--         Go back
ctrl-shift--   Go forward

Line and Character Movement

cmd-up         Move cursor to top of file
cmd-down       Move cursor to bottom of file
cmd-left       Move cursor to start of line
cmd-right      Move cursor to end of line
ctrl-up        Move cursor up one screen
ctrl-down      Move cursor down one screen

Editing Shortcuts

Basic Editing

cmd-z          Undo
cmd-shift-z    Redo
cmd-x          Cut
cmd-c          Copy
cmd-v          Paste
cmd-shift-v    Paste from history
cmd-a          Select all
cmd-d          Select next occurrence of current selection
cmd-k cmd-c    Toggle comment
cmd-shift-d    Duplicate line down
cmd-shift-k    Delete current line

Indentation and Formatting

tab            Indent line
shift-tab      Outdent line
cmd-shift-i    Format document
cmd-k cmd-f    Format selection

Line Operations

cmd-shift-up     Move line up
cmd-shift-down   Move line down
cmd-enter        Insert line below
cmd-shift-enter  Insert line above

Multi-Cursor and Selection

Multi-cursor editing is one of Zed's most powerful features. It allows you to edit multiple locations simultaneously.

Adding Cursors

cmd-d            Add next matching selection
cmd-shift-l      Select all occurrences of current selection
cmd-shift-up     Add cursor above
cmd-shift-down   Add cursor below
cmd-alt-up       Add cursor above (alternative)
cmd-alt-down     Add cursor below (alternative)

Expanding Selection

ctrl-shift-up    Expand selection to enclosing syntax node
ctrl-shift-down  Shrink selection
cmd-shift-a      Expand selection to containing block

Practical Example

Suppose you have a list of variables and want to rename them all at once. Place your cursor on the first variable name, then press cmd-d repeatedly to select each occurrence. Once all are selected, type the new name:

// Before:
const userName = "alice";
const userAge = 30;
const userEmail = "alice@example.com";

// Select "user" in each line with cmd-d, then type "account"
// After:
const accountName = "alice";
const accountAge = 30;
const accountEmail = "alice@example.com";

Search and Replace

In-File Search

cmd-f          Find in current file
cmd-g          Find next
cmd-shift-g    Find previous
cmd-alt-f      Replace in current file
cmd-enter      Replace all

Project-Wide Search

cmd-shift-f    Search across entire project
cmd-shift-h    Replace across entire project

The project search panel supports regular expressions, case sensitivity, and whole-word matching. Toggle these with the buttons in the search bar or use keyboard shortcuts:

alt-cmd-r      Toggle regex mode
alt-cmd-c      Toggle case sensitivity
alt-cmd-w      Toggle whole word matching

Window and Pane Management

Splitting Panes

cmd-\           Split pane right
cmd-k cmd-\     Split pane down
cmd-1           Focus pane 1
cmd-2           Focus pane 2
cmd-3           Focus pane 3
cmd-w           Close current pane

Moving Between Panes

cmd-k cmd-left     Move focus to left pane
cmd-k cmd-right    Move focus to right pane
cmd-k cmd-up       Move focus to upper pane
cmd-k cmd-down     Move focus to lower pane

Tab Management

ctrl-tab        Next tab
ctrl-shift-tab  Previous tab
cmd-shift-t     Reopen recently closed tab

The Command Palette

The command palette is your gateway to every action in Zed. Press cmd-shift-p to open it. You can search for any command by name, and Zed will fuzzy-match your input.

cmd-shift-p    Open command palette

From the command palette you can:

Terminal Integration

Zed includes a built-in terminal. You can toggle it without leaving your keyboard:

ctrl-`          Toggle terminal
cmd-shift-`    New terminal in workspace

Inside the terminal, standard shell shortcuts apply. To return focus to the editor, press ctrl-` again or use cmd-1 to focus the first pane.

Vim Mode

Zed has first-class Vim support. To enable it, open your settings file and add:

{
  "vim_mode": true
}

Once enabled, all standard Vim modal editing commands work, including:

i              Insert mode
esc            Normal mode
:w             Save (in command mode)
dd             Delete line
yy             Yank line
p              Paste
ciw            Change inner word
vi(            Select inside parentheses

You can also layer custom keybindings on top of Vim mode by targeting the VimControl context:

[
  {
    "context": "VimControl && !menu",
    "bindings": {
      "space f": "pane::RevealInProjectPanel",
      "space g": "git::ToggleGitPanel"
    }
  }
]

Customizing Your Keymap

Overriding Default Bindings

To override a default binding, simply add the same key combination to your keymap.json with a different action. Zed merges user bindings with defaults, and user bindings take precedence.

[
  {
    "context": "Editor",
    "bindings": {
      "cmd-e": "editor::SelectAll"
    }
  }
]

Unbinding a Shortcut

If you want to remove a default binding entirely, assign it to null:

[
  {
    "context": "Editor",
    "bindings": {
      "cmd-d": null
    }
  }
]

Using Key Chords

Zed supports key chords, similar to Emacs. Separate the keys with a space:

[
  {
    "context": "Workspace",
    "bindings": {
      "cmd-k cmd-s": "workspace::SaveAll"
    }
  }
]

Best Practices

Learn Incrementally

Do not try to memorize every shortcut at once. Start with the essentials: file navigation (cmd-t), search (cmd-shift-f), and multi-cursor (cmd-d). Add new shortcuts to your workflow one at a time.

Customize for Your Workflow

Every developer has different habits. If you are coming from VS Code, consider installing the VS Code keymap preset. If you are a Vim user, enable Vim mode and layer your custom leader bindings on top.

Keep Your Keymap Under Version Control

Your keymap.json and settings.json files represent your personalized editing environment. Store them in a dotfiles repository so you can sync them across machines:

# In your dotfiles repo
ln -s ~/dotfiles/zed/keymap.json ~/.config/zed/keymap.json
ln -s ~/dotfiles/zed/settings.json ~/.config/zed/settings.json

Avoid Conflicting Bindings

When adding custom bindings, check that they do not conflict with existing ones in the same context. Zed will warn you in the keymap file if a binding is duplicated, but it is good practice to review your changes carefully.

Use Contexts Wisely

Take advantage of Zed's context system. A binding that makes sense in the editor may not make sense in the terminal. Scope your bindings to the appropriate context to avoid unexpected behavior.

Leverage the Command Palette as a Learning Tool

When you discover a new feature, look up its action name in the command palette. You can then bind it to a shortcut of your choice. This is the fastest way to expand your shortcut vocabulary.

Conclusion

Zed's keyboard shortcut system is one of its greatest strengths. By understanding the context-based keymap model, learning the core navigation and editing shortcuts, and customizing bindings to fit your workflow, you can transform Zed into a deeply personal and highly efficient editing environment. Start with the basics, build muscle memory over time, and do not hesitate to remap anything that does not feel natural. The more you invest in mastering Zed's keyboard shortcuts, the faster and more enjoyable your coding experience will become.

— Ad —

Google AdSense will appear here after approval

← Back to all articles