✍️ Explore the Zed Editor:The Future of Code Editor
A code editor is typically a lightweight tool focused on editing source code, providing essential features like syntax highlighting, text editing, and file management. Code editors are often highly customizable and extensible, allowing users to add additional functionalities such as syntax checking and version control by installing plugins.
Unlike Integrated Development Environments (IDEs), code editors are generally not tied to specific development frameworks or languages. Due to having fewer built-in features, they tend to be faster, with quicker startup times and lower system resource usage.
I. What is Zed? 🧐
Zed is a next-generation code editor designed for high-performance collaboration with humans and AI.
Zed Editor is a code editor that supports real-time collaboration, developed by Nathan Sobo, who was previously known for creating the Atom text editor while working at GitHub. Built with Rust at its core, Zed is designed for "high performance" 😮, excelling in areas such as input latency, startup time, and memory usage.
Zed Editor enters the scene with a fresh visual appeal, aiming to provide developers with an efficient, smooth, and intuitive 👍 programming environment.
Founder Nathan's Views in the Interview 💭:
"My dream tool needs to be both powerful and have a sleek, minimalist appearance, and it must run incredibly fast. However, achieving both ultra-fast speed and powerful functionality is challenging. I can say that most of my career has been spent trying to combine these two aspects, which is precisely Zed's goal. At the same time, we tend to adhere to minimalism in user experience."
"I don't want to replace the command line experience with buttons; that doesn't make sense to me. I like being close to the machine, communicating with it in a language-like manner. I hope the IDE can recognize the existence of the terminal and command line and integrate them cleanly, rather than trying to define everything in a visual interface. As a natural extension and complement to the Unix philosophy, I think this suits me better. However, if I can run tests with a shortcut key instead of switching to the terminal, pressing the up arrow, and then Enter, I would gladly accept it. But I don't want it to hide the essence, because it's essentially running a command."
"My goal has always been to create a lightweight, minimalist product that feels like a text editor but has the powerful features of an IDE, avoiding the laggy experience and bulky UI. This is what I wanted from the very beginning, and it should also be extensible."
II. Why Choose Zed? 😎
1. Fast ⚡
Zed Editor's lightweight design enables quick startup, making it an ideal choice for efficiency-focused developers. It emphasizes simplicity, focusing on speed and optimized resource usage, ensuring easy adoption without complex configurations. At the same time, it offers extensive customization options to meet the advanced needs of power users.
2. Intelligent 💻
Zed Editor integrates AI-assisted coding features, enhancing the development experience by making it smarter and more efficient. Whether it's code completion, error detection, or automated refactoring, AI supports you at every step of your coding process. This intelligent assistance not only speeds up development but also reduces errors and repetitive tasks in manual coding.
3. Collaborative 📶
Zed Editor's most modern feature is its support for team collaboration. By using Channels and CRDTs, it allows multiple developers to work on the same file simultaneously, facilitating real-time communication and collaboration within the development team.
III. How to Use Zed? 😉
1. Quick Start 📝
Zed Editor currently supports MacOS and Linux systems, with official Windows support coming soon! On Mac, Zed supports versions from Catalina (10.15) to Sonoma (14.x). For Linux, you'll need to install the necessary dependencies—check out the System Requirements - Zed for more details.
The official Windows version of Zed Editor hasn't been released yet.
However, there are a few ways to use Zed on Windows:
- Compile it yourself or use a precompiled version from others.
- Use WSL (Windows Subsystem for Linux) to run the Linux version of Zed Editor within WSL.
2. Custom Configuration ✍️
👉 Official Guide: Configuring Zed - Zed
👉 Default Settings: zed/assets/settings/default.json
To open the settings.json file, you have two options:
- Use the shortcut
Ctrl , - Open the command palette with
Ctrl Shift Pand typezed: open settingsto open thesettings.jsonfile
Vim Mode
Zed Editor has built-in support for Vim mode. To enable it, add "vim_mode": true, to the settings.json file.
Proxy
Replace proxy.example.com and port with your proxy server's address and port.
To set up a proxy, add "proxy": "http://proxy.example.com:port", to the settings.json file. This will facilitate the use of Zed AI. After making changes, close and restart Zed Editor to apply the new proxy settings.
Theme Configuration
👉 Explore different themes: Zed themes
- You can preview built-in themes via the
Themeoption in the dropdown menu under your avatar in the top-right corner. - To install theme plugins, go to
Extensionunder the same menu. For instance, you can install thebase16plugin and select thesnazzytheme. - To customize themes, place a theme JSON file (like
zedspace.jsonfrom GitHub - Brunowilliang/zedspace) under.config/zed/themes/. Then, add the following to yoursettings.jsonfile:
// Change the theme name
"theme": {
"mode": "dark",
"light": "One Light",
"dark": "ZedSpace Dark Theme"
},
👉 For more configuration options, check out the official guide: Themes - Zed
Appearance Configuration
"ui_font_size": 22,
// Font style for the user interface (UI)
"ui_font_family": "Cascadia Mono PL",
"buffer_font_size": 26,
// Font style for the code editing area (Buffer)
"buffer_font_family": "JetBrains Mono",
"buffer_font_weight": 500,
"relative_line_numbers": true,
// Hide navigation history buttons in the tab bar
"tab_bar": {
"show_nav_history_buttons": false
},
// Enable file icons and Git status in tabs
"tabs": {
"file_icons": true,
"git_status": true
},
// Inlay hints settings
"inlay_hints": {
"enabled": true,
"font_family": "Consolas"
},
// Color by indentation level
"indent_guides": {
"coloring": "indent_aware"
},
// Enable soft wrapping, automatically wrap lines when they exceed editor width
"soft_wrap": "editor_width",
Basic Configuration
Zed Editor comes with built-in formatting capabilities through the Language Server Protocol (LSP).
"tab_size": 2,
// Enable auto-formatting on file save
"format_on_save": "on",
// Set vertical scroll margin
"vertical_scroll_margin": 6,
// Do not restore previous files or sessions on startup
"restore_on_startup": "none",
// Disable continuing comments on new lines
"extend_comment_on_newline": false,
// Associate specific file extensions with their respective file types
"file_types": {
"C++": ["c", "h", "cpp", "hpp"],
"*.mdx": ["markdown"]
},
// File and directory patterns to exclude during file scanning
"file_scan_exclusions": [
"**/.git",
"**/.svn",
"**/.hg",
"**/CVS",
"**/.DS_Store",
"**/Thumbs.db",
"**/.classpath",
"**/.settings",
"**/vendor",
"**/.tmp*"
],
// Files and directories to exclude during search
"search.exclude": {
"**/*.snap": true,
"**/.git": true,
"**/.github": false,
"**/.nuxt": true,
"**/.output": true,
"**/.pnpm": true,
"**/.vscode": true,
"**/.yarn": true,
"**/node_modules": true,
"**/out/**": true,
"**/package-lock.json": true,
"**/pnpm-lock.yaml": true,
"**/temp": true,
"**/yarn.lock": true,
"**/CHANGELOG*": true,
"**/LICENSE*": true
},
"terminal": {
"font_family": "Cascadia Code NF",
"toolbar": {
"title": false
},
// Enable auto-copy to clipboard when text is selected in the terminal
"copy_on_select": true
},
"git": {
// Enable Git integration
"enabled": true,
// Automatically fetch latest changes from remote repository periodically
"autoFetch": true,
// Set auto-fetch interval to 300 seconds (5 minutes)
"autoFetchInterval": 300,
// Automatically fetch latest Git changes when editor gains focus
"autoFetchOnFocus": true,
// Automatically fetch latest Git changes when switching editor windows
"autoFetchOnWindowChange": true,
// Automatically fetch latest Git changes during build events
"autoFetchOnBuild": true,
// Display Git status in the editor
"git_status": true,
// Auto-fetch Git changes during specific build events (e.g., build, run, debug)
"autoFetchOnBuildEvents": [
"build",
"run",
"debug"
],
// Delay auto-fetch by 1500 milliseconds (1.5 seconds) after build events
"autoFetchOnBuildEventsDelay": 1500,
// Delay auto-fetch by 1500 milliseconds (1.5 seconds) after build
"autoFetchOnBuildDelay": 1500,
// Display Git status in the editor's gutter, only for tracked files
"git_gutter": "tracked_files",
// Display inline blame with commit information beside code lines
"inline_blame": {
"enabled": false,
"position": "right"
}
},
You need to manually run the git pull command to merge changes ⛔
Development Configuration
Zed Editor excels in language configuration, offering out-of-the-box support for multiple languages, automatic formatting, code completion, and more, greatly simplifying the setup process for developers.
source.organizeImports: true: Automatically organize import statements during code formatting.source.fixAll.eslint: true: Automatically fix all issues reported by ESLint during code formatting.
"languages": {
"C++": {
"formatter": {
"external": {
"command": "clang-format",
"arguments": ["-style={BasedOnStyle: Google, IndentWidth: 2}"]
}
}
},
"Go": {
"code_actions_on_format": {
"source.organizeImports": true
}
},
"Rust": {
"tab_size": 2
},
"TSX": {
"formatter": {
"external": {
"command": "prettier",
"arguments": ["--stdin-filepath", "{buffer_path}", "--tab-width", "2"]
}
},
"code_actions_on_format": {
"source.organizeImports": true,
"source.fixAll.eslint": true
}
},
"JavaScript": {
"formatter": {
"external": {
"command": "prettier",
"arguments": ["--stdin-filepath", "{buffer_path}", "--tab-width", "2"]
}
},
"code_actions_on_format": {
"source.fixAll.eslint": true
}
},
"TypeScript": {
"formatter": {
"external": {
"command": "prettier",
"arguments": ["--stdin-filepath", "{buffer_path}", "--tab-width", "2"]
}
},
"code_actions_on_format": {
"source.organizeImports": true,
"source.fixAll.eslint": true
}
}
},
"lsp": {
"rust-analyzer": {
"initialization_options": {
"checkOnSave": {
// rust-analyzer.check.command (default: "check")
// "command": "clippy"
}
}
},
"eslint": {
"settings": {
"codeActionOnSave": {
"rules": ["import/order"]
}
}
}
}
In Rust, check is frequently used during daily coding, and clippy is used periodically or before code reviews. clippy is a lint tool for Rust that provides additional code style and error checks.
Telemetry Settings
Do not allow Zed Industries to collect anonymous usage data.
"telemetry": {
"diagnostics": false,
"metrics": false
}
3. Shortcuts ⌨️
Zed Editor’s key bindings are configured using json/jsonc format. For example:
[
{
"context": "Workspace",
"bindings": {}
}
]
context specifies the conditions under which the corresponding key bindings will be active.
- Pane
- Workspace
- Editor
- Menu
- Terminal
- Assistant
- ProjectPanel
- ProjectSearch
- BufferSearch
- Search
- Dock
- EmptyPane
- SharedScreen
- VimControl
- vim_mode == normal
- vim_mode == visual
- vim_mode == insert
- vim_mode == replace
- vim_mode == operator
- vim_mode == waiting
bindings specifies the key combinations; they can be strings, objects, or arrays.
System Default Shortcuts
To view the default keymap, open the command palette with Ctrl Shift P, then type zed: open default keymap.
Custom Shortcuts
To customize your shortcuts, type zed: open keymap to open the keymap.json file and make your modifications.
[
{
"bindings": {
"ctrl-shift-p": "command_palette::Toggle",
"ctrl-shift-k": "zed::OpenKeymap",
"ctrl-shift-x": "zed::Extensions",
"f11": "zed::ToggleFullScreen",
"ctrl-alt-n": "task::Spawn",
"ctrl-alt-r": "task::Rerun",
"ctrl-alt-o": "zed::OpenLocalTasks",
"ctrl-\\": "workspace::NewCenterTerminal",
"ctrl-t": "terminal_panel::ToggleFocus"
}
},
{
"context": "Workspace",
"bindings": {
"shift shift": "workspace::NewSearch"
}
},
{
"context": "Editor",
"bindings": {
"ctrl-a": "editor::SelectAll",
"ctrl-w": "pane::CloseActiveItem",
"alt-enter": "editor::ToggleCodeActions"
}
},
{
"context": "Editor && VimControl && !VimWaiting && !menu",
"bindings": {
"H": "pane::ActivatePrevItem",
"L": "pane::ActivateNextItem",
"K": "editor::Hover",
"g h": "editor::MoveToBeginningOfLine",
"g l": "editor::MoveToEndOfLine",
"g b": "pane::GoBack",
"g r": "editor::GoToTypeDefinition",
"g i": "editor::GoToImplementation",
"space c f": "editor::Format",
"space c r": "editor::Rename",
"space e": "project_panel::ToggleFocus",
"space f o": "outline::Toggle",
"space f p": "projects::OpenRecent",
"space f q": "file_finder::Toggle",
"space g [": "editor::GoToPrevHunk",
"space g ]": "editor::GoToHunk",
"space g b": "editor::ToggleGitBlame",
"space g d": "editor::ToggleHunkDiff",
"space g r": "editor::RevertSelectedHunks",
"space m o": "markdown::OpenPreview",
"space m p": "markdown::OpenPreviewToTheSide",
"space o": "tab_switcher::Toggle",
"space p d": "diagnostics::Deploy",
"space w c": "pane::CloseAllItems",
"space w k": "pane::SplitUp",
"space w j": "pane::SplitDown",
"space w h": "pane::SplitLeft",
"space w l": "pane::SplitRight"
}
},
{
"context": "ProjectPanel && not_editing",
"bindings": {
"j": "menu::SelectNext",
"k": "menu::SelectPrev",
"a": "project_panel::NewFile",
"A": "project_panel::NewDirectory",
"c": "project_panel::Copy",
"d": "project_panel::Delete",
"p": "project_panel::Paste",
"r": "project_panel::Rename",
"x": "project_panel::Cut",
"y p": "project_panel::CopyPath",
"y r": "project_panel::CopyRelativePath"
}
},
{
"context": "Dock || Terminal || Editor",
"bindings": {
"ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-j": ["workspace::ActivatePaneInDirection", "Down"]
}
},
{
"context": "Terminal",
"bindings": {
"ctrl-t": "workspace::ToggleBottomDock"
}
}
]