Editing Basics

Master fundamental text editing techniques in Zed

The Zed Editing Philosophy

Zed's editing capabilities combine the best features from modern editors with unique optimizations:

  • Performance: Native, GPU-backed editing stays responsive in large files
  • Precision: Powerful selection and multi-cursor tools
  • Intelligence: Language servers, Tree-sitter structure, and AI edit prediction
  • Flexibility: Customizable to match your workflow (including Vim or Helix modes)

Zed uses Tree-sitter for parsing and understanding your code, enabling accurate syntax highlighting, structural selections, and smarter editing operations.

Text Selection

Text Selection in Zed

Basic Selection

Zed offers several ways to select text:

  • Mouse Selection: Click and drag to select text
  • Keyboard Selection: Hold Shift while using arrow keys
  • Word Selection: Double-click a word, or move/select by word with Alt/Option + arrows
  • Line Selection: Triple-click a line, or use the line-select shortcut below
Action macOS Linux/Windows
Select line L CtrlL
Select next occurrence D CtrlD
Select all occurrences ShiftL CtrlShiftL

Smart Selection

Because Zed understands code structure via Tree-sitter, you can grow selections by syntax node:

  • Expand / shrink selection: Use the Command Palette and search for editor: select larger syntax node / editor: select smaller syntax node (bindings can vary by keymap)
  • Select to bracket: Search the Command Palette for bracket / surrounding pair selection if you use it often
  • Select all occurrences: Place a cursor on every match of the current selection with the shortcuts above

Press Esc to collapse multiple selections back to a single cursor.

Multiple Cursors

One of Zed's most powerful features is editing in multiple places simultaneously:

Creating Multiple Cursors

Action macOS Linux/Windows
Add cursor with mouse + Click Alt + Click
Column / box selection Shift + drag AltShift + drag
Add cursor above CtrlAlt
Add cursor below CtrlAlt
Select next occurrence D CtrlD
Select all occurrences ShiftL CtrlShiftL
Multiple Cursors

Multiple cursors work with nearly all editing operations, including typing, deletion, selection expansion, and clipboard operations.

Common Use Cases

  1. Rename Multiple Variables (local)

    Select a symbol, select all occurrences, then type to replace them in the current file. For project-wide renames, prefer a language-server rename (see Diagnostics & Quick Fixes below) or a Multibuffer workflow.

  2. Add Text to Multiple Lines

    Add cursors above/below, then type once to edit every line.

  3. Convert Data Formats

    Use column selection to transform columns of data between formats.

Text Manipulation

Basic Editing

Action macOS Linux/Windows
Cut / Copy / Paste X / C / V CtrlX / CtrlC / CtrlV
Delete line ShiftK CtrlShiftK
Duplicate selection / line ShiftD CtrlShiftD
Join lines J CtrlJ

Moving Text

Action macOS Linux/Windows
Move line up Alt
Move line down Alt
Indent / Outdent Tab / ShiftTab Tab / ShiftTab

Transformations

  • Open the Command Palette and search for transform commands such as uppercase / lowercase
  • Many transformations also appear when you have an active selection

Find and Replace

Basic Find

Open the find bar, then step through matches:

Action macOS Linux/Windows
Find in buffer F CtrlF
Find next Enter Enter
Find previous ShiftEnter ShiftEnter
Find Dialog

Find and Replace

Action macOS Linux/Windows
Replace in buffer F CtrlH
Project search ShiftF CtrlShiftF
  • Enter search term and replacement text
  • Replace the current match, or replace all matches in the buffer

Search Options

  • Case Sensitivity: Toggle case-sensitive search
  • Whole Word: Match only complete words
  • Regular Expressions: Use regex patterns for advanced searching

Project search results open in a Multibuffer so you can edit every match across files in one view.

Edit Prediction

Edit Prediction shows AI-powered ghost-text completions as you type — similar in spirit to Copilot-style suggestions. Providers can include Zed's Zeta model and other configured backends.

  • Keep typing to refine the prediction, or accept when it looks right
  • Acceptance / partial-accept bindings depend on your settings and provider
  • Disable or reconfigure edit prediction in Settings if you prefer classic completions only
Edit Prediction

Edit Prediction is separate from the Inline Assistant and Agent Panel. Predictions help with local completion; the assistant tools are for explicit prompts and larger edits.

Multibuffers

A Multibuffer is a single editor view that aggregates excerpts from many files. It is one of Zed's distinctive editing surfaces for cross-file work.

Common ways you enter a Multibuffer:

  • Project search results: Edit every hit without hopping file-to-file
  • Diagnostics: Review and fix errors across the project in one list of excerpts
  • Rename / find references style workflows: Apply structured multi-file edits when the language server supports them
Multibuffer editing

Edits in a Multibuffer write back to the underlying files. Save as usual after reviewing the combined changes.

Inline Assistant

Use the Inline Assistant for quick, prompt-driven edits at the cursor or on a selection — generate a function, rewrite a block, add tests, or explain and transform code in place.

Action macOS Linux/Windows
Inline Assistant Enter CtrlEnter
Agent Panel (longer tasks) ShiftA CtrlShiftA
  1. Select context (optional)

    Highlight the code you want transformed, or place the cursor where new code should appear.

  2. Open the Inline Assistant

    Trigger the shortcut, write a short instruction, and accept or iterate on the result.

Language Server Diagnostics & Quick Fixes

When a language server is active, Zed surfaces errors and warnings in the editor gutter, the status bar, and diagnostic views.

  • Inline diagnostics: Squiggles and hover details explain the problem
  • Quick fixes / code actions: Apply server-provided fixes from the Code Actions menu
  • Project diagnostics: Open a Multibuffer of issues across the workspace

Open the Command Palette and search for code actions, diagnostic, or quick fix to discover the bindings on your platform and keymap.

Code Folding

Code folding collapses sections of code so you can focus on the parts that matter:

Fold Operations

Action macOS Linux/Windows
Fold [ CtrlShift[
Unfold ] CtrlShift]
Fold all K 0 CtrlK Ctrl0
Unfold all K J CtrlK CtrlJ
Code Folding

If a fold chord conflicts with your custom keymap, search the Command Palette for editor: fold / editor: unfold.

Auto-Completion and Snippets

Auto-Completion

Zed provides intelligent code completion as you type (language-server and word-based sources), alongside optional Edit Prediction:

  • Completion menus appear automatically while typing
  • Use Tab or Enter to accept (depending on settings)
  • Use arrow keys to navigate between suggestions
  • Press Esc to dismiss suggestions
Auto-Completion

Code Snippets

Snippets are pre-defined code templates you can insert quickly:

  • Type the snippet prefix and select it from the suggestions
  • Use Tab to move between snippet placeholders
  • Edit placeholder values to customize the inserted template

Language servers provide context-aware completions based on your codebase, imported libraries, and standard language features. Install language extensions when a server is missing.

Formatting and Indentation

Auto-Indentation

Zed automatically indents your code based on language rules and Tree-sitter structure:

  • Press Enter to create a new line with proper indentation
  • Opening braces or brackets typically indent the next line
  • Closing braces or brackets align with their opening pair

Manual Formatting

Action macOS Linux/Windows
Format document ShiftI CtrlShiftI
Format selection K F CtrlK CtrlF

Enable format on save in settings ("format_on_save": "on") to format automatically whenever you save.

Whitespace and Indentation Settings

Customize indentation in the Settings Editor or settings.json:

  • Tab Size: Width of tab / indent units
  • Soft Tabs: Insert spaces instead of tab characters
  • Detect Indentation: Match a file's existing style when opening it

What's Next?

With core editing covered — including AI prediction, Multibuffers, and the Inline Assistant — continue to Navigation to move through files, symbols, and large codebases efficiently.