Zed: Difference between revisions
m update, format, use native features |
|||
| Line 30: | Line 30: | ||
==== Shell ==== <!--T:4--> | ==== Shell ==== <!--T:4--> | ||
</translate> | </translate> | ||
<syntaxhighlight lang="console"> | |||
nix run github:zed-industries/zed | |||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:5--> | <!--T:5--> | ||
| Line 40: | Line 44: | ||
==== System setup ==== <!--T:7--> | ==== System setup ==== <!--T:7--> | ||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | |||
# In /etc/nixos/configuration.nix | |||
environment.systemPackages = [ | environment.systemPackages = [ | ||
pkgs.zed-editor | pkgs.zed-editor | ||
| Line 49: | Line 55: | ||
pkgs.zed-editor | pkgs.zed-editor | ||
]; | ]; | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:8--> | <!--T:8--> | ||
| Line 59: | Line 66: | ||
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. | 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> | </translate> | ||
<syntaxhighlight lang="nix"> | |||
inputs.zed.url = "github:zed-industries/zed"; | |||
outputs = { self, nixpkgs, zed, ... }@inputs: let | outputs = { self, nixpkgs, zed, ... }@inputs: let | ||
| Line 66: | Line 75: | ||
in { | in { | ||
packages.${system}.zed-latest = zed.packages.${system}.default; | packages.${system}.zed-latest = zed.packages.${system}.default; | ||
}; | }; | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:11--> | <!--T:11--> | ||
| Line 83: | Line 94: | ||
==== Basic ==== <!--T:15--> | ==== Basic ==== <!--T:15--> | ||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | |||
programs.zed-editor = { | |||
enable = true; | enable = true; | ||
extensions = [ "nix" "toml" "rust" ]; | extensions = [ "nix" "toml" "rust" ]; | ||
| Line 95: | Line 108: | ||
vim_mode = true; | vim_mode = true; | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:16--> | <!--T:16--> | ||
| Line 102: | Line 117: | ||
==== Advanced ==== <!--T:17--> | ==== Advanced ==== <!--T:17--> | ||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | |||
programs.zed-editor = { | programs.zed-editor = { | ||
enable = true; | enable = true; | ||
| Line 234: | Line 250: | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:18--> | <!--T:18--> | ||
| Line 270: | Line 287: | ||
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> | ||
<syntaxhighlight lang="nix"> | |||
pkgs.zed-editor.fhsWithPackages( | |||
pkgs: with pkgs; [ | |||
openssl | |||
zlib | |||
] | |||
) | |||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:26--> | <!--T:26--> | ||
| Line 289: | Line 315: | ||
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> | ||
<syntaxhighlight lang="json"> | |||
{ | |||
"lsp": { | "lsp": { | ||
"rust-analyzer": { | "rust-analyzer": { | ||
| Line 298: | Line 326: | ||
} | } | ||
} | } | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:30--> | <!--T:30--> | ||
| Line 313: | Line 342: | ||
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> | ||
<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 358: | ||
Alternatively, use Home Manager's built-in option for simpler setup: | Alternatively, use Home Manager's built-in option for simpler setup: | ||
</translate> | </translate> | ||
<syntaxhighlight lang="nix">programs.zed-editor = { | |||
enable = true; | enable = true; | ||
installRemoteServer = true; | installRemoteServer = true; | ||
}; | };</syntaxhighlight> | ||
<translate> | <translate> | ||
<!--T:35--> | <!--T:35--> | ||
| Line 344: | Line 379: | ||
==== Preinstall extensions ==== | ==== Preinstall extensions ==== | ||
<syntaxhighlight lang="json"> | |||
{ | |||
"extensions": [ | "extensions": [ | ||
"nix", | "nix", | ||
| Line 351: | Line 387: | ||
] | ] | ||
} | } | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:37--> | <!--T:37--> | ||