Redoing all my old work

This commit is contained in:
Katie Geer
2025-12-18 10:12:19 -08:00
parent 942669d5c3
commit bc0d86e9bb
11 changed files with 5093 additions and 5295 deletions

View File

@@ -173,12 +173,11 @@
# Reference
- [All Settings](./reference/all-settings.md)
- [All Actions](./reference/all-actions.md)
- [Default Key Bindings](./reference/default-key-bindings.md)
- [CLI Reference](./reference/cli.md)
- [Environment Variables](./reference/environment-variables.md)
- [Glob Patterns](./reference/glob-patterns.md)
- [All Settings](./configuring-zed.md)
- [All Actions](./all-actions.md)
- [CLI Reference](./command-line-interface.md)
- [Environment Variables](./environment.md)
- [Glob Patterns](./globs.md)
# Account & Privacy

View File

@@ -1 +1,3 @@
# All Actions
{#ACTIONS_TABLE#}

View File

@@ -1 +1,18 @@
# Command-line Interface
Zed has a CLI, on Linux this should come with the distribution's Zed package (binary name can vary from distribution to distribution, `zed` will be used later for brevity).
For macOS, the CLI comes in the same package with the editor binary, and could be installed into the system with the `cli: install` Zed command which will create a symlink to the `/usr/local/bin/zed`.
It can also be built from source out of the `cli` crate in this repository.
Use `zed --help` to see the full list of capabilities.
General highlights:
- Opening another empty Zed window: `zed`
- Opening a file or directory in Zed: `zed /path/to/entry` (use `-n` to open in the new window)
- Reading from stdin: `ps axf | zed -`
- Starting Zed with logs in the terminal: `zed --foreground`
- Uninstalling Zed and all its related files: `zed --uninstall`

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1,92 @@
# Environment Variables
_**Note**: The following only applies to Zed 0.152.0 and later._
Multiple features in Zed are affected by environment variables:
- Tasks
- Built-in terminal
- Look-up of language servers
- Language servers
In order to make the best use of these features, it's helpful to understand where Zed gets its environment variables from and how they're used.
## Where does Zed get its environment variables from?
How Zed was started — whether it's icon was clicked in the macOS Dock or in a Linux window manager, or whether it was started via the CLI `zed` that comes with Zed — influences which environment variables Zed can use.
### Launched from the CLI
If Zed is opened via the CLI (`zed`), it will inherit the environment variables from the surrounding shell session.
That means if you do
```
$ export MY_ENV_VAR=hello
$ zed .
```
the environment variable `MY_ENV_VAR` is now available inside Zed. For example, in the built-in terminal.
Starting with Zed 0.152.0, the CLI `zed` will _always_ pass along its environment to Zed, regardless of whether a Zed instance was previously running or not. Prior to Zed 0.152.0 this was not the case and only the first Zed instance would inherit the environment variables.
### Launched via window manager, Dock, or launcher
When Zed has been launched via the macOS Dock, or a GNOME or KDE icon on Linux, or an application launcher like Alfred or Raycast, it has no surrounding shell environment from which to inherit its environment variables.
In order to still have a useful environment, Zed spawns a login shell in the user's home directory and gets its environment. This environment is then set on the Zed _process_. That means all Zed windows and projects will inherit that home directory environment.
Since that can lead to problems for users that require different environment variables for a project (because they use `direnv`, or `asdf`, or `mise`, ... in that project), when opening project, Zed spawns another login shell. This time in the project's directory. The environment from that login shell is _not_ set on the process (because that would mean opening a new project changes the environment for all Zed windows). Instead, the environment is stored and passed along when running tasks, opening terminals, or spawning language servers.
## Where and how are environment variables used?
There are two sets of environment variables:
1. Environment variables of the Zed process
2. Environment variables stored per project
The variables from (1) are always used, since they are stored on the process itself and every spawned process (tasks, terminals, language servers, ...) will inherit them by default.
The variables from (2) are used explicitly, depending on the feature.
### Tasks
Tasks are spawned with an combined environment. In order of precedence (low to high, with the last overwriting the first):
- the Zed process environment
- if the project was opened from the CLI: the CLI environment
- if the project was not opened from the CLI: the project environment variables obtained by running a login shell in the project's root folder
- optional, explicitly configured environment in settings
### Built-in terminal
Built-in terminals, like tasks, are spawned with an combined environment. In order of precedence (low to high):
- the Zed process environment
- if the project was opened from the CLI: the CLI environment
- if the project was not opened from the CLI: the project environment variables obtained by running a login shell in the project's root folder
- optional, explicitly configured environment in settings
### Look-up of language servers
For some languages the language server adapters lookup the binary in the user's `$PATH`. Examples:
- Go
- Zig
- Rust (if [configured to do so](./languages/rust.md#binary))
- C
- TypeScript
For this look-up, Zed uses the following the environment:
- if the project was opened from the CLI: the CLI environment
- if the project was not opened from the CLI: the project environment variables obtained by running a login shell in the project's root folder
### Language servers
After looking up a language server, Zed starts them.
These language server processes always inherit Zed's process environment. But, depending on the language server look-up, additional environment variables might be set or overwrite the process environment.
- If the language server was found in the project environment's `$PATH`, then the project environment's is passed along to the language server process. Where the project environment comes from depends on how the project was opened, via CLI or not. See previous point on look-up of language servers.
- If the language servers was not found in the project environment, Zed tries to install it globally and start it globally. In that case, the process will inherit Zed's process environment, and — if the project was opened via ClI — from the CLI.

View File

@@ -1,5 +1 @@
# All Actions
This reference lists every action available in Zed. Use these action names in your [keymap](../key-bindings.md) or trigger them directly from the command palette.
{#ACTIONS_TABLE#}

File diff suppressed because it is too large Load Diff

View File

@@ -1,90 +1 @@
# CLI Reference
Zed includes a command-line interface for opening files, directories, and controlling the editor from your terminal.
## Installation
- **macOS**: Run `cli: install` from the command palette to create a symlink at `/usr/local/bin/zed`
- **Linux**: The CLI is included with your distribution's Zed package (binary name may vary)
## Usage
```sh
zed [OPTIONS] [PATHS...]
```
## Common Commands
| Command | Description |
|---------|-------------|
| `zed` | Open an empty Zed window |
| `zed .` | Open the current directory as a project |
| `zed /path/to/file` | Open a specific file |
| `zed /path/to/folder` | Open a folder as a project |
| `zed file1.rs file2.rs` | Open multiple files |
| `zed -n /path` | Open in a new window |
| `ps aux \| zed -` | Read from stdin |
## Options
| Option | Description |
|--------|-------------|
| `-w`, `--wait` | Wait for all given paths to be opened/closed before exiting |
| `-a`, `--add` | Add files to the currently open workspace |
| `-n`, `--new` | Create a new workspace |
| `-r`, `--reuse` | Reuse an existing window, replacing its workspace |
| `-` | Read from stdin |
| `--foreground` | Run Zed in the foreground (useful for debugging, shows all logs) |
| `--zed <PATH>` | Custom path to Zed.app or the zed binary |
| `--dev-server-token <TOKEN>` | Run Zed in dev-server mode with the given token |
| `--diff <OLD_PATH> <NEW_PATH>` | Open a diff view comparing two files (can be used multiple times) |
| `--user-data-dir <DIR>` | Set a custom directory for all user data (database, extensions, logs) |
| `--uninstall` | Uninstall Zed and all related files (Linux/macOS only) |
| `--version` | Print Zed's version and the app path |
## Opening Files at a Specific Line
You can open a file at a specific line and column:
```sh
zed /path/to/file:42 # Open at line 42
zed /path/to/file:42:10 # Open at line 42, column 10
```
## Examples
Open the current directory in Zed:
```sh
zed .
```
Open a file and wait for it to close (useful for Git commit messages):
```sh
GIT_EDITOR="zed -w" git commit
```
Pipe command output into Zed:
```sh
cat /var/log/system.log | zed -
```
Open multiple files in a new window:
```sh
zed -n src/main.rs src/lib.rs
```
Compare two files:
```sh
zed --diff old_version.rs new_version.rs
```
Add files to an existing workspace:
```sh
zed -a additional_file.rs
```

View File

@@ -1,102 +1 @@
# Default Key Bindings
Zed ships with default key bindings optimized for each platform. You can customize these in your [keymap file](../key-bindings.md).
## View Default Keymaps
The complete default keymaps are maintained in the Zed repository:
| Platform | Keymap File |
|----------|-------------|
| macOS | [default-macos.json](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-macos.json) |
| Windows | [default-windows.json](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-windows.json) |
| Linux | [default-linux.json](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-linux.json) |
## Essential Bindings
These are the most commonly used default bindings. Platform-specific keys are shown as `Cmd` (macOS) / `Ctrl` (Linux/Windows).
### General
| Action | macOS | Linux/Windows |
|--------|-------|---------------|
| Command palette | `Cmd+Shift+P` | `Ctrl+Shift+P` |
| Settings | `Cmd+,` | `Ctrl+,` |
| File finder | `Cmd+P` | `Ctrl+P` |
| Project search | `Cmd+Shift+F` | `Ctrl+Shift+F` |
| Toggle terminal | `` Ctrl+` `` | `` Ctrl+` `` |
| Toggle left dock | `Cmd+B` | `Ctrl+B` |
### Editing
| Action | macOS | Linux/Windows |
|--------|-------|---------------|
| Cut | `Cmd+X` | `Ctrl+X` |
| Copy | `Cmd+C` | `Ctrl+C` |
| Paste | `Cmd+V` | `Ctrl+V` |
| Undo | `Cmd+Z` | `Ctrl+Z` |
| Redo | `Cmd+Shift+Z` | `Ctrl+Shift+Z` |
| Save | `Cmd+S` | `Ctrl+S` |
| Find in buffer | `Cmd+F` | `Ctrl+F` |
| Replace in buffer | `Cmd+Alt+F` | `Ctrl+H` |
| Project search with replace | `Cmd+Shift+H` | `Ctrl+Shift+H` |
| Comment line | `Cmd+/` | `Ctrl+/` |
| Format document | `Cmd+Shift+I` | `Ctrl+Shift+I` |
### Navigation
| Action | macOS | Linux/Windows |
|--------|-------|---------------|
| Go to line | `Ctrl+G` | `Ctrl+G` |
| Go to definition | `F12` | `F12` |
| Go to implementation | `Shift+F12` | `Shift+F12` (Linux), `Ctrl+F12` (Windows) |
| Find all references | `Alt+Shift+F12` | `Alt+Shift+F12` (Linux), `Shift+Alt+F12` (Windows) |
| Go to symbol in file | `Cmd+Shift+O` | `Ctrl+Shift+O` |
| Go back | `Ctrl+-` | `Ctrl+Alt+-` (Linux), `Alt+Left` (Windows) |
| Go forward | `Ctrl+_` | `Ctrl+Alt+_` (Linux), `Alt+Right` (Windows) |
### Multi-cursor
| Action | macOS | Linux/Windows |
|--------|-------|---------------|
| Add cursor above | `Cmd+Alt+Up` | `Shift+Alt+Up` (Linux), `Ctrl+Alt+Up` (Windows) |
| Add cursor below | `Cmd+Alt+Down` | `Shift+Alt+Down` (Linux), `Ctrl+Alt+Down` (Windows) |
| Select next occurrence | `Cmd+D` | `Ctrl+D` |
| Select all occurrences | `Cmd+Shift+L` | `Ctrl+Shift+L` |
### Panels
| Action | macOS | Linux/Windows |
|--------|-------|---------------|
| Project panel | `Cmd+Shift+E` | `Ctrl+Shift+E` |
| Outline panel | `Cmd+Shift+B` | `Ctrl+Shift+B` |
| Git panel | `Ctrl+Shift+G` | `Ctrl+Shift+G` |
| Agent panel | `Cmd+?` | `Ctrl+?` (Linux), `Ctrl+Shift+/` (Windows) |
## Predefined Keymaps
If you prefer another editor's bindings, open the Settings Editor (`Cmd+,` on macOS, `Ctrl+,` on Linux/Windows) and search for `base_keymap`. Select your preferred keymap from the dropdown.
Or add this to your settings.json:
```json
{
"base_keymap": "VSCode"
}
```
Available options:
- `VSCode` (default)
- `JetBrains`
- `SublimeText`
- `Atom`
- `TextMate`
- `Emacs`
- `Cursor`
- `None`
## See Also
- [Custom Key Bindings](../key-bindings.md) for creating your own bindings
- [All Actions](./all-actions.md) for the complete list of bindable actions
- [Vim Mode](../vim.md) for modal editing

View File

@@ -1,60 +1 @@
# Environment Variables
This page lists environment variables that affect Zed's behavior.
## Where Zed Gets Environment Variables
| Launch Method | Environment Source |
|---------------|-------------------|
| CLI (`zed .`) | Inherits from the shell session |
| Dock / Launcher / Window Manager | Spawns a login shell in home directory |
| Per-project | Spawns a login shell in the project directory |
When launched via the CLI, Zed inherits environment variables from your shell. When launched from the Dock or a launcher, Zed spawns a login shell to obtain a base environment.
For project-specific environments (e.g., when using `direnv`, `asdf`, or `mise`), Zed spawns an additional login shell in the project directory and stores those variables for use in tasks, terminals, and language servers.
## Environment Variable Reference
| Variable | Purpose |
|----------|---------|
| `XDG_CONFIG_HOME` | On Linux, overrides the default config location (`~/.config/zed`) |
| `ZED_LOG_LEVEL` | Sets the log verbosity (`debug`, `info`, `warn`, `error`) |
| `ZED_BUNDLE` | When set, indicates Zed is running as a bundled app |
| `ZED_STATELESS` | When set, Zed won't persist window state between sessions |
| `ZED_ALWAYS_ACTIVE` | When set, Zed behaves as if it's always the active application |
| `http_proxy` / `HTTP_PROXY` | HTTP proxy URL for network requests |
| `https_proxy` / `HTTPS_PROXY` | HTTPS proxy URL for network requests |
| `no_proxy` / `NO_PROXY` | Comma-separated list of hosts to bypass proxy |
## Variables Set by Zed
Zed sets these variables in spawned processes (tasks, terminals, language servers):
| Variable | Value |
|----------|-------|
| `ZED_TERM` | Set in the integrated terminal |
| `TERM` | Set to a terminal type in the integrated terminal |
| `EDITOR` | Set to `zed --wait` when appropriate |
| `VISUAL` | Set to `zed --wait` when appropriate |
## Usage in Tasks and Terminals
Environment variables from your project are available in:
- **Tasks**: All task commands have access to the project environment
- **Terminal**: The integrated terminal inherits project-specific variables
- **Language servers**: Servers spawned for a project use that project's environment
```json
{
"tasks": [
{
"label": "echo env",
"command": "echo $MY_PROJECT_VAR"
}
]
}
```
> **Note:** Environment handling changed in Zed 0.152.0. The CLI now always passes its environment to Zed, even when an instance is already running.

View File

@@ -1,51 +1 @@
# Glob Patterns
Glob patterns are Unix shell-style wildcards for matching file paths, like `*.md` or `docs/**/*.rs`. Zed uses globs in search filters, file exclusions, and various settings.
## Syntax Reference
| Pattern | Matches | Example |
|---------|---------|---------|
| `?` | Any single character | `?.md` matches `a.md`, not `ab.md` |
| `*` | Any sequence of characters (except `/`) | `*.rs` matches `main.rs`, `lib.rs` |
| `**` | Any directory depth (including zero) | `src/**/*.rs` matches `src/main.rs`, `src/lib/utils.rs` |
| `[abc]` | Any one character in brackets | `[abc].txt` matches `a.txt`, `b.txt`, `c.txt` |
| `[a-z]` | Any character in range | `[0-9].log` matches `1.log`, `9.log` |
| `[!abc]` | Any character not in brackets | `[!0-9].txt` matches `a.txt`, not `1.txt` |
## Common Examples
```/dev/null/examples.txt#L1-12
# File extensions
*.rs # All Rust files
*.{rs,toml} # NOT supported - use multiple patterns
# Directory matching
docs/**/*.md # All Markdown files under docs/
**/test_*.py # Test files in any directory
# Case-insensitive matching (globs are case-sensitive)
*.[cC] # Matches .c and .C files
```
## Where Globs Are Used
| Feature | Setting/Location | Notes |
|---------|------------------|-------|
| Project search | Include/Exclude filters | Filter search results by path |
| File excludes | `file_scan_exclusions` | Hide files from project panel |
| Search excludes | `search.exclude` | Exclude from search results |
| Formatter overrides | `languages.*.format_on_save` | Match files for formatting rules |
## Notes
- Globs in Zed are **case-sensitive**. On macOS (case-insensitive filesystem), `*.c` won't match `Main.C`.
- Brace expansion (`{a,b,c}`) is **not supported**. Use separate patterns instead.
- Patterns are matched against the full path from the project root.
- To match a literal `-` in brackets, place it first or last: `[-abc]` or `[abc-]`.
- To match a literal `[` or `]`, use `[[]` or `[]]`.
## See Also
- [Configuring Zed](../configuring-zed.md) for settings that accept glob patterns
- [gitignore patterns](https://git-scm.com/docs/gitignore#_pattern_format) use similar but not identical syntax