This post is a part of my "Zed is the Future?" series


Despite its name, I would argue that most time in a text editor is actually not spent editing. Instead, it is spent navigating between and within files that you are working with. Let's explore how to efficiently navigate with Zed!

As a quick aside, I intend this post to be a living lab notebook that I use to share my progress on the topic.

Setup

I will mostly focus on the keyboard-centric navigation, as this is my preferred setup. I use Zed Vim mode and shortcuts below rely on it (by the way, you can find all available shortcuts in Vim mode by opening a Command Palette and typing vim: open default keymap).

To add a bit of structure, I will distinguish between two different types of navigation:

  • Local navigation: Moving and jumping within a single buffer to specific lines, words or characters
  • Global navigation: Moving between different files and searching across an entire project workspace

Local navigation

Vim motions

Local navigation is a bread and butter of Vim Motions - the key shortcuts in Vim Normal mode that move the cursor to specific locations in the text.

I won't describe them in detail, but there is an excellent guided tour and a cheatsheet that lists the most useful ones. Suffice to say that Zed implements them quite faithfully. There are also motions specific to Zed Treesitter integration that are useful for navigating structured file formats, e.g., code or JSON.

Here are the ones that I find most useful:

  • w/b: move to the beginning of the next/previous word
  • CTRL + g: move to a specific line number
  • /, then n/N: search for a specific text in the buffer and cycle through the results forwards/backwards
  • gg/G: move to the beginning/end of the file

When I'm using Vim, I feel there is a gap that needs to be filled between very efficient navigation within a single line with f motion and a bit more clumsy general search with /. This gap is usually filled for me by EasyMotion-style movement (specifically flash.nvim) that allows to move to any visible character with just a few letter keypresses. Unfortunately, Zed does not have a built-in equivalent yet, but this is a very popular feature request.

Symbol outline

Given the native Treesitter and LSP integration, symbol navigation feels quite reliable.

  • CTRL + SHIFT + o (or g s in Vim): list and search symbols in the buffer
  • CTRL + SHIFT + b: open and focus the symbol outline panel
  • CTRL + SHIFT + f: opens a workspace-wide text search panel where you can type any text to find its occurrences across all files
  • g /: automatically searches for the currently selected text across all files in the workspace
  • CTRL + p: opens a fuzzy search dialog that lets you quickly find and open any file by name in the workspace
  • g d: go to definition of the symbol under cursor (e.g. a function name or variable)
  • g S: search for any symbol (functions, classes, etc.) across all files in the workspace