Guides And Tips Published: September 7, 2024

Zed AI Overview and Tips

Exploring Zed IDE capabilities and AI features

Introduction to Zed

Zed describes itself as a high-performance, multiplayer code editor created by the makers of Atom and Tree-sitter. The core team is:

Zed is open-source and accepts contributions from the community. You can explore Zed further on their official website and check out the source code on GitHub.

Zed recently introduced AI features as Zed AI. Zed is partnering with Anthropic and providing early access to some Anthropic models, such as fast editing.

Zed and Zed AI Overall Impression

As of today (Sept 7th) I think Zed itself is great and that Zed AI has room to improve before I would really considering switching away from Cursor. There are a few pieces missing for me that I detailed in the Friction Log post about Zed.

I think over the long run Zed will be very competitive. Owning the entire IDE and having written it from the ground up to be fast is going to unlock some interesting capabilities! In constrast the folks at Cursor are going to have battle with the extensive VSCode source code.

A small but powerful example of this is that Zed's Search Symbols UI/UX feels tremendously better than VSCode's. I bet in absolute terms there is a few ms difference between the two, but Zed's feels a lot snappier.

Big Picture Idea

Zed's "Context Panel", which is the primary way to interact with Zed AI, is all text-based. That gives it a distinct feel and it works differently than Cursor's. So if you are trying Zed out after using Cursor you will have a bit of a learning curve. Zed just does things differently.

I highly recommend spending some time reviewing all of Zed's default shortcuts and adjusting them to fit your personal style.

Zed AI Quick Start

If you know the following you're pretty much ready to roll with Zed:

  • Zed's context panel is all markdown. Expect it to feel different than VSCode / Cursor's.
  • Zed has a command pallete and the commands available depend on which pane you are focused on.
    • Check here if you aren't sure how to do something.
  • Use CMD+? (CMD+Shift+/) to toggle between editor focus and context pane focus.
    • This is a critical short cut to get familiar with!
  • Use CMD+> and CMD+< to insert code from the editor to the context panel and vis versa.
  • Zed uses CMD+K to start a sequence of keyboard short cuts. For example, when focused on a context CMD+K and then h will bring you to that context.
  • CMD+I opens the Inline Assist
  • / within the Context Pane opens up the slash command menu.

Inline Editor

Zed AI's inline editor can be triggered from the command (assistant: Inline Assit) and I believe it has a default command of CMD+I. This is equivelant of CMD+K in Cursor.

You can accept inline assist changes by hitting enter again. You must still be focused on the inline editor box though.

Overall I find this works well enough, but importantly there is no way to @-tag files in the Inline Assist like you can in Cursor. I think that is a major limiter right now.

Zed Context Panel

The big "side panel" you get in Zed is for managing your context. The neat part about this is the whole side bar is one big markdown field, enabling you to edit all of it. It has build in slash commands that are accessed by typing / as the first character in a line.

Building Context

  • When you open a new context it DOES NOT have your current file automatically referenced. You need to access it via the tab slash command.
  • All context items are inserted as plain text. You can use the dropdown caret to open up the context and edit it.
  • The slash commands generally insert text of some sort.
    • Symbols: Inserts current files symbols
    • Workflow: Inserts a preset prompt for guiding the AI through a workflow
    • Fetch: Provide fetch a URL and it will grab the content off that URL for you. Great for inserting docs!
  • Use CMD+> to insert code from the editor into the context window
    • Note that this will insert the code exactly where your cursor last was in the context window!
  • Use CMD+< to insert code from the editor into the context window

Cycling Zed Context

  • Context persists as tabs. You can cycle between them with CMD+[ and CMD+]. This works if you are currently focused on the context pane
  • Context history is saved and you can quickly access it via CMD+K > h. Or via the command palette "assistant: deploy history" (I don't know what the "deploy" part of that means.). This has full text search!

Store Prompts

  • You can view, edit and create prompts via "assistant: deploy prompts" command, accessible when you are focused on a context. CMD+K > l will also open it.
  • You can then use those prompts via the prompts / command. Storing prompts for repetitive workflows is the easiest way to start getting a ton of value out of AI enable IDEs.

Workflow Slash Command

The Slash Command: Workflow is a little uninutitive. It inserts a detailed prompt that tells the model how to format it's output. This special formatting can then be interpreted by Zed itself.

Each workflow step will render a "Transform" button. Clicking this is how you apply edits from the context window into your editor.

Right now I think it's easier to just select the relevant code using shift+arrow keys and then use the CMD+< short cut to insert that code into the editor.

My Context Panel Workflow

When I want the AI to make a change I'll create a fresh context and then go through:

  • Slash Command: Tab to insert the current file
  • Slash Command: File to insert other files needed as context
  • Slash Command: Prompt if I have a pre-saved prompt for this workflow
  • Slash Command: Workflow I end with this so the AI will format the output in an easy to apply way.

Copyright © 2024