logiguard fork: GPUI xdg-activation keyboard-focus serial fix
Some checks failed
Update All Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Triage Project Sync (#84) / Sync triage project (push) Has been cancelled
release_nightly / notify_on_failure (push) Has been cancelled
release_nightly / check_style (push) Has been cancelled
release_nightly / run_tests_windows (push) Has been cancelled
release_nightly / clippy_windows (push) Has been cancelled
release_nightly / bundle_linux_aarch64 (push) Has been cancelled
release_nightly / bundle_linux_x86_64 (push) Has been cancelled
release_nightly / bundle_mac_aarch64 (push) Has been cancelled
release_nightly / bundle_mac_x86_64 (push) Has been cancelled
release_nightly / bundle_windows_aarch64 (push) Has been cancelled
release_nightly / bundle_windows_x86_64 (push) Has been cancelled
release_nightly / build_nix_linux_x86_64 (push) Has been cancelled
release_nightly / build_nix_mac_aarch64 (push) Has been cancelled
release_nightly / update_nightly_tag (push) Has been cancelled
Hotfix Review Monitor / check-hotfix-reviews (push) Has been cancelled
Stale PR Review Reminder / check-stale-prs (push) Has been cancelled
Update Weekly Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Bump collab-staging Tag / update-collab-staging-tag (push) Has been cancelled
compliance_check / scheduled_compliance_check (push) Has been cancelled
Some checks failed
Update All Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Triage Project Sync (#84) / Sync triage project (push) Has been cancelled
release_nightly / notify_on_failure (push) Has been cancelled
release_nightly / check_style (push) Has been cancelled
release_nightly / run_tests_windows (push) Has been cancelled
release_nightly / clippy_windows (push) Has been cancelled
release_nightly / bundle_linux_aarch64 (push) Has been cancelled
release_nightly / bundle_linux_x86_64 (push) Has been cancelled
release_nightly / bundle_mac_aarch64 (push) Has been cancelled
release_nightly / bundle_mac_x86_64 (push) Has been cancelled
release_nightly / bundle_windows_aarch64 (push) Has been cancelled
release_nightly / bundle_windows_x86_64 (push) Has been cancelled
release_nightly / build_nix_linux_x86_64 (push) Has been cancelled
release_nightly / build_nix_mac_aarch64 (push) Has been cancelled
release_nightly / update_nightly_tag (push) Has been cancelled
Hotfix Review Monitor / check-hotfix-reviews (push) Has been cancelled
Stale PR Review Reminder / check-stale-prs (push) Has been cancelled
Update Weekly Top Ranking Issues / update_top_ranking_issues (push) Has been cancelled
Bump collab-staging Tag / update-collab-staging-tag (push) Has been cancelled
compliance_check / scheduled_compliance_check (push) Has been cancelled
Single-commit orphan branch: full zed-industries/zed @ 8c74db0 source tree with a 3-file patch applied (no upstream history). Patch (crates/gpui_linux/src/linux/wayland/): - serial.rs: add SerialKind::KeyboardEnter - client.rs: store wl_keyboard.enter serial; add latest_serial_of() - window.rs: activate() uses keyboard-enter serial (Mutter focus gate) Mutter honors window activation only when the token carries the keyboard- focus serial from wl_keyboard.enter; GPUI used a stale mouse-press serial. See docs/tray-window-focus-wayland.md in logiguard. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
202
docs/src/reference/cli.md
Normal file
202
docs/src/reference/cli.md
Normal file
@@ -0,0 +1,202 @@
|
||||
---
|
||||
title: CLI Reference
|
||||
description: "Reference for Zed's command-line interface (CLI), including opening files and directories, integrating with tools, and controlling Zed from scripts."
|
||||
---
|
||||
|
||||
# CLI Reference
|
||||
|
||||
Use Zed's command-line interface (CLI) to open files and directories, integrate with other tools, and control Zed from scripts.
|
||||
|
||||
## Installation
|
||||
|
||||
**macOS:** Run the {#action cli::InstallCliBinary} command from the command palette ({#kb command_palette::Toggle}) to install the `zed` CLI to `/usr/local/bin/zed`.
|
||||
|
||||
**Linux:** The CLI is included with Zed packages. The binary name may vary by distribution (commonly `zed` or `zeditor`).
|
||||
|
||||
**Windows:** The CLI is included with Zed. Add Zed's installation directory to your PATH, or use the full path to `zed.exe`.
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
zed [OPTIONS] [PATHS]...
|
||||
```
|
||||
|
||||
## Opening Files and Directories
|
||||
|
||||
Open a file:
|
||||
|
||||
```sh
|
||||
zed myfile.txt
|
||||
```
|
||||
|
||||
Open a directory as a workspace:
|
||||
|
||||
```sh
|
||||
zed ~/projects/myproject
|
||||
```
|
||||
|
||||
Open multiple files or directories:
|
||||
|
||||
```sh
|
||||
zed file1.txt file2.txt ~/projects/myproject
|
||||
```
|
||||
|
||||
Open a file at a specific line and column:
|
||||
|
||||
```sh
|
||||
zed myfile.txt:42 # Open at line 42
|
||||
zed myfile.txt:42:10 # Open at line 42, column 10
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `-w`, `--wait`
|
||||
|
||||
Wait for all opened files to be closed before the CLI exits. When opening a directory, waits until the window is closed.
|
||||
|
||||
This is useful for integrating Zed with tools that expect an editor to block until editing is complete (e.g., `git commit`):
|
||||
|
||||
```sh
|
||||
export EDITOR="zed --wait"
|
||||
git commit # Opens Zed and waits for you to close the commit message file
|
||||
```
|
||||
|
||||
### `-n`, `--new`
|
||||
|
||||
Open paths in a new workspace window, even if the paths are already open in an existing window:
|
||||
|
||||
```sh
|
||||
zed -n ~/projects/myproject
|
||||
```
|
||||
|
||||
### `-a`, `--add`
|
||||
|
||||
Add paths to the currently focused workspace instead of opening a new window. When multiple workspace windows are open, files open in the focused window:
|
||||
|
||||
```sh
|
||||
zed -a newfile.txt
|
||||
```
|
||||
|
||||
### `-r`, `--reuse`
|
||||
|
||||
Reuse an existing window, replacing its current workspace with the new paths:
|
||||
|
||||
```sh
|
||||
zed -r ~/projects/different-project
|
||||
```
|
||||
|
||||
By default (without `-n`, `-a`, or `-r`), directories open in the current window's sidebar. You can change this default with the `cli_default_open_behavior` setting. See [Windows & Projects](../windows-and-projects.md) for more details.
|
||||
|
||||
### `--diff <OLD_PATH> <NEW_PATH>`
|
||||
|
||||
Open a diff view comparing two files. Can be specified multiple times:
|
||||
|
||||
```sh
|
||||
zed --diff file1.txt file2.txt
|
||||
zed --diff old.rs new.rs --diff old2.rs new2.rs
|
||||
```
|
||||
|
||||
### `--foreground`
|
||||
|
||||
Run Zed in the foreground, keeping the terminal attached. Useful for debugging:
|
||||
|
||||
```sh
|
||||
zed --foreground
|
||||
```
|
||||
|
||||
### `--user-data-dir <DIR>`
|
||||
|
||||
Use a custom directory for all user data (database, extensions, logs) instead of the default location:
|
||||
|
||||
```sh
|
||||
zed --user-data-dir ~/.zed-custom
|
||||
```
|
||||
|
||||
Default locations:
|
||||
|
||||
- **macOS:** `~/Library/Application Support/Zed`
|
||||
- **Linux:** `$XDG_DATA_HOME/zed` (typically `~/.local/share/zed`)
|
||||
- **Windows:** `%LOCALAPPDATA%\Zed`
|
||||
|
||||
### `-v`, `--version`
|
||||
|
||||
Print Zed's version and exit:
|
||||
|
||||
```sh
|
||||
zed --version
|
||||
```
|
||||
|
||||
### `--uninstall`
|
||||
|
||||
Uninstall Zed and remove all related files (macOS and Linux only):
|
||||
|
||||
```sh
|
||||
zed --uninstall
|
||||
```
|
||||
|
||||
### `--zed <PATH>`
|
||||
|
||||
Specify a custom path to the Zed application or binary:
|
||||
|
||||
```sh
|
||||
zed --zed /path/to/Zed.app myfile.txt
|
||||
```
|
||||
|
||||
## Reading from Standard Input
|
||||
|
||||
Read content from stdin by passing `-` as the path:
|
||||
|
||||
```sh
|
||||
echo "Hello, World!" | zed -
|
||||
cat myfile.txt | zed -
|
||||
ps aux | zed -
|
||||
```
|
||||
|
||||
This creates a temporary file with the stdin content and opens it in Zed.
|
||||
|
||||
## URL Handling
|
||||
|
||||
The CLI can open `zed://`, `file://`, and `ssh://` URLs:
|
||||
|
||||
```sh
|
||||
zed zed://settings
|
||||
zed file:///Users/whatever/.zshrc
|
||||
zed ssh://me@example.com/abs/path
|
||||
zed ssh://me@example.com:/abs/path
|
||||
zed ssh://me@example.com/~/project
|
||||
zed ssh://me@example.com:~/project
|
||||
```
|
||||
|
||||
## Using Zed as Your Default Editor
|
||||
|
||||
Set Zed as your default editor for Git and other tools:
|
||||
|
||||
```sh
|
||||
export EDITOR="zed --wait"
|
||||
export VISUAL="zed --wait"
|
||||
```
|
||||
|
||||
Add these lines to your shell configuration file (e.g., `~/.bashrc`, `~/.zshrc`).
|
||||
|
||||
## macOS: Switching Release Channels
|
||||
|
||||
On macOS, you can launch a specific release channel by passing the channel name as the first argument:
|
||||
|
||||
```sh
|
||||
zed --stable myfile.txt
|
||||
zed --preview myfile.txt
|
||||
zed --nightly myfile.txt
|
||||
```
|
||||
|
||||
## WSL Integration (Windows)
|
||||
|
||||
On Windows, the CLI supports opening paths from WSL distributions. This is handled automatically when launching Zed from within WSL.
|
||||
|
||||
## Exit Codes
|
||||
|
||||
| Code | Meaning |
|
||||
| ---- | --------------------------------- |
|
||||
| `0` | Success |
|
||||
| `1` | Error (details printed to stderr) |
|
||||
|
||||
When using `--wait`, the exit code reflects whether the files were saved before closing.
|
||||
Reference in New Issue
Block a user