Zed: Difference between revisions

Merrkry (talk | contribs)
m fix typo in the option's name
 
(4 intermediate revisions by 2 users not shown)
Line 19: Line 19:
<!--T:1-->
<!--T:1-->
[https://zed.dev Zed]<ref>Zed Industries, "Zed", Official Website, Accessed October 2025. https://zed.dev</ref> is a collaborative, GPU-accelerated text editor developed by Zed Industries. It combines fast local editing with real-time multiplayer features and ships with batteries-included tooling for popular programming languages.
[https://zed.dev Zed]<ref>Zed Industries, "Zed", Official Website, Accessed October 2025. https://zed.dev</ref> is a collaborative, GPU-accelerated text editor developed by Zed Industries. It combines fast local editing with real-time multiplayer features and ships with batteries-included tooling for popular programming languages.
</translate>
 
<translate>
<!--T:2-->
<!--T:2-->
The editor provides native builds for Linux, including Nixpkgs packages and a reproducible flake. Hardware acceleration requires a GPU with Vulkan support; systems without Vulkan can fall back to emulation via tools such as [https://github.com/nix-community/nixGL nixGL].<ref>Zed Industries, "Linux", Zed Documentation, Accessed October 2025. https://zed.dev/docs/linux</ref>
The editor provides native builds for Linux, including Nixpkgs packages and a reproducible flake. Hardware acceleration requires a GPU with Vulkan support; systems without Vulkan can fall back to emulation via tools such as [https://github.com/nix-community/nixGL nixGL].<ref>Zed Industries, "Linux", Zed Documentation, Accessed October 2025. https://zed.dev/docs/linux</ref>
</translate>


<translate>
<!--T:5-->
{{Nixpkg|pkgs/by-name/ze/zed-editor|zed-editor}} is available in Nixpkgs since 24.11; However, Zed provides [https://github.com/zed-industries/zed/blob/main/flake.nix an official nix flake] which might be useful if you need features that have not yet reached unstable Nixpkgs.
 
== Installation == <!--T:3-->
== Installation == <!--T:3-->


==== Shell ==== <!--T:4-->
<!--T:6-->
The package installs both desktop launchers and a CLI entry point aliased to <code>zeditor</code>, mirroring the upstream binary name
 
=== Imperative === <!--T:4-->
 
==== Zed's Flake ==== <!--T:45-->
</translate>
</translate>
{{code|lang=bash|line=no|1=$ nix-shell -p zed-editor}}
 
<syntaxhighlight lang="console">
nix run github:zed-industries/zed
</syntaxhighlight>
 
==== Nixpkgs ====
 
<syntaxhighlight lang="console">
nix run nixpkgs#zed-editor
</syntaxhighlight>
 
<translate>
<translate>
<!--T:5-->
=== Declarative === <!--T:7-->
The <code>zed-editor</code> package is available in Nixpkgs from channel 24.11 onward. The command above provides <code>zed-editor</code> in the current shell session without modifying any configuration files.
</translate>


<!--T:6-->
==== NixOS ====
The package installs both desktop launchers and a CLI entry point aliased to <code>zeditor</code>, mirroring the upstream binary name.


==== System setup ==== <!--T:7-->
<syntaxhighlight lang="nix">
</translate>
{{code|lang=nix|line=no|1=# In /etc/nixos/configuration.nix
environment.systemPackages = [
environment.systemPackages = [
   pkgs.zed-editor
   pkgs.zed-editor
];
];
</syntaxhighlight>


# In home-manager configuration (home.nix)
{{Evaluate}}
==== Home Manager ====
 
<syntaxhighlight lang="nix">
home.packages = [
home.packages = [
   pkgs.zed-editor
   pkgs.zed-editor
];
];
}}
</syntaxhighlight>
 
<syntaxhighlight lang="console">
home-manager switch
</syntaxhighlight>
 
<translate>
<translate>
<!--T:8-->
==== Zed's Flake ==== <!--T:9-->
Rebuild your system or Home Manager profile to make Zed available persistently. On NixOS, run <code>sudo nixos-rebuild switch</code>; for Home Manager, run <code>home-manager switch</code>.
</translate>


==== Flake ==== <!--T:9-->
<syntaxhighlight lang="nix">
{
  inputs.zed.url = "github:zed-industries/zed";


<!--T:10-->
  outputs =
Zed maintains an official flake for tracking the latest upstream build. This approach is useful if you need features that have not yet reached stable Nixpkgs.
    {
</translate>
      self,
{{code|lang=nix|line=no|1=inputs.zed.url = "github:zed-industries/zed";
      nixpkgs,
      zed,
      ...
    }@inputs:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs { inherit system; };
    in
    {
      packages.${system}.zed-latest = zed.packages.${system}.default;
    };
}
</syntaxhighlight>


outputs = { self, nixpkgs, zed, ... }@inputs: let
  system = "x86_64-linux";
  pkgs = import nixpkgs { inherit system; };
in {
  packages.${system}.zed-latest = zed.packages.${system}.default;
};}}
<translate>
<translate>
<!--T:11-->
<!--T:11-->
Build the flake package with <code>nix build .#zed-latest</code> or expose it in your configuration with the appropriate overlay.
Build the flake package with <code>nix build .#zed-latest</code> or expose it in your configuration with the appropriate overlay.
</translate>
 
{{Warning|Zed requires hardware-accelerated Vulkan. On systems without supported drivers, use <code>nixGL</code> or home-manager's <code>nixGL.vulkan.enable {{=}} true;</code> to provide the necessary libraries.}}
<translate>
<!--T:12-->
<!--T:12-->
Providing Vulkan through <code>nixGL</code> can be more consistent than relying on host distribution packages, especially on non-NixOS systems where Wayland and X11 stacks differ in their Vulkan capabilities.
{{Warning|Zed requires hardware-accelerated Vulkan. On systems without supported drivers, use <code>nixGL</code> or home-manager's <code>nixGL.vulkan.enable {{=}} true;</code> to provide the necessary libraries.
Providing Vulkan through <code>nixGL</code> can be more consistent than relying on host distribution packages, especially on non-NixOS systems where Wayland and X11 stacks differ in their Vulkan capabilities.}}


== Configuration == <!--T:13-->
== Configuration == <!--T:13-->
Line 83: Line 111:
==== Basic ==== <!--T:15-->
==== Basic ==== <!--T:15-->
</translate>
</translate>
{{code|lang=nix|line=no|1=programs.zed-editor = {
 
<syntaxhighlight lang="nix">
programs.zed-editor = {
   enable = true;
   enable = true;
   extensions = [ "nix" "toml" "rust" ];
   extensions = [ "nix" "toml" "rust" ];
Line 95: Line 125:
     vim_mode = true;
     vim_mode = true;
   };
   };
};}}
};
</syntaxhighlight>
 
<translate>
<translate>
<!--T:16-->
<!--T:16-->
Line 102: Line 134:
==== Advanced ==== <!--T:17-->
==== Advanced ==== <!--T:17-->
</translate>
</translate>
{{code|lang=nix|line=no|1=
 
<syntaxhighlight lang="nix">
programs.zed-editor = {
programs.zed-editor = {
   enable = true;
   enable = true;
Line 234: Line 267:
   };
   };
};
};
}}
</syntaxhighlight>
 
<translate>
<translate>
<!--T:18-->
<!--T:18-->
Line 240: Line 274:


<!--T:19-->
<!--T:19-->
The <code>userSettings</code> and <code>userKeyMaps</code> options translate directly into JSON. The <code>extraPackages</code> option includes additional Nixpkgs in the FHS environment, useful for LSP servers (e.g., <code>pkgs.nixd</code>) or optional tools (e.g., <code>pkgs.shellcheck</code> for the Basher LSP).
The <code>userSettings</code> and <code>userKeymaps</code> options translate directly into JSON. The <code>extraPackages</code> option includes additional Nixpkgs in the FHS environment, useful for LSP servers (e.g., <code>pkgs.nixd</code>) or optional tools (e.g., <code>pkgs.shellcheck</code> for the Basher LSP).


<!--T:20-->
<!--T:20-->
Line 270: Line 304:
Use <code>pkgs.zed-editor.fhsWithPackages</code> to extend the FHS environment with additional system libraries when a language server requires them.
Use <code>pkgs.zed-editor.fhsWithPackages</code> to extend the FHS environment with additional system libraries when a language server requires them.
</translate>
</translate>
{{code|lang=nix|line=no|1=pkgs.zed-editor.fhsWithPackages (pkgs: with pkgs; [ openssl zlib ])}}
 
<syntaxhighlight lang="nix">
pkgs.zed-editor.fhsWithPackages(
  pkgs: with pkgs; [
    openssl
    zlib
  ]
)
</syntaxhighlight>
 
<translate>
<translate>
<!--T:26-->
<!--T:26-->
Line 289: Line 332:
If automatic detection doesn't work, specify the path manually in your Zed configuration:
If automatic detection doesn't work, specify the path manually in your Zed configuration:
</translate>
</translate>
{{code|lang=json|line=no|1={
 
<syntaxhighlight lang="json">
{
   "lsp": {
   "lsp": {
     "rust-analyzer": {
     "rust-analyzer": {
Line 298: Line 343:
   }
   }
}
}
}}
</syntaxhighlight>
 
<translate>
<translate>
<!--T:30-->
<!--T:30-->
Line 313: Line 359:
When you connect to a remote machine, the client either downloads a matching server binary from upstream or pushes a local copy if <code>"upload_binary_over_ssh": true</code> is enabled. Connections fail if the versions diverge.
When you connect to a remote machine, the client either downloads a matching server binary from upstream or pushes a local copy if <code>"upload_binary_over_ssh": true</code> is enabled. Connections fail if the versions diverge.
</translate>
</translate>
{{code|lang=nix|line=no|1=home.file.".zed_server" = {
 
<syntaxhighlight lang="nix">
home.file.".zed_server" = {
   source = "${pkgs.zed-editor.remote_server}/bin";
   source = "${pkgs.zed-editor.remote_server}/bin";
   recursive = true;
   recursive = true;
};}}
};
</syntaxhighlight>
 
<translate>
<translate>
<!--T:33-->
<!--T:33-->
Line 325: Line 375:
Alternatively, use Home Manager's built-in option for simpler setup:
Alternatively, use Home Manager's built-in option for simpler setup:
</translate>
</translate>
{{code|lang=nix|line=no|1=programs.zed-editor = {
 
<syntaxhighlight lang="nix">programs.zed-editor = {
   enable = true;
   enable = true;
   installRemoteServer = true;
   installRemoteServer = true;
};}}
};</syntaxhighlight>
 
<translate>
<translate>
<!--T:35-->
<!--T:35-->
Line 344: Line 396:


==== Preinstall extensions ====
==== Preinstall extensions ====
{{code|lang=json|line=no|1={
<syntaxhighlight lang="json">
{
   "extensions": [
   "extensions": [
     "nix",
     "nix",
Line 351: Line 404:
   ]
   ]
}
}
}}
</syntaxhighlight>
 
<translate>
<translate>
<!--T:37-->
<!--T:37-->