The Zed text editor CLI (Command Line Interface) provides a suite of tools designed to interact with Zed from your terminal. These tools allow you to:
1. Launch Zed and Open Files/Directories:
zed <path/to/file> or zed <path/to/directory>: This is the most basic function. It opens the specified file or directory in the Zed editor. If Zed is not already running, it will launch a new instance.
2. Interact with Zed Instances:
zed --socket <socket_path> (Implied by default): Specifies the socket to connect to a Zed instance. Usually automatically handled, but can be useful for connecting to a specific instance if you have multiple running.
3. Remote Collaboration and Project Management (Key Use Cases):
zed join <project_id>: Joins an existing collaborative project in Zed, given the project's ID. This is how you participate in a collaborative editing session.
zed invite <email>: Invites a user to a project you are participating in. They must already have a Zed account for this to work.
zed project <project_id>: Opens the project configuration for a given project_id.
4. Workspace Management:
zed workspace <name>: Opens a specific workspace in Zed. This is useful for organizing your projects.
zed new-workspace <name>: Creates a new workspace.
5. Authentication and Account Management:
zed auth login: Initiates the login process for your Zed account. This is usually handled automatically within Zed, but you might need it if you're setting up Zed on a headless server or troubleshooting authentication issues.
zed auth logout: Logs you out of your Zed account.
6. Advanced Features (May Vary Depending on Zed Version):
- Zed CLI is under active development, so its capabilities might change and expand. Check the official Zed documentation (
zed --help) for the most up-to-date information. Potential uses include:
- Integrating with build tools and linters.
- Automating tasks within Zed.
- Scripting interactions with Zed projects.
In summary, the Zed CLI tools are primarily used for:
- Quickly opening files and directories in Zed.
- Managing and joining collaborative projects.
- Workspace management.
- Authentication.
- Potentially, advanced scripting and integration with other tools.
How to get help with the CLI:
Use the command zed --help in your terminal. This will display a list of available commands and their options. You can also use zed <command> --help to get more detailed help for a specific command (e.g., zed join --help).
Remember to install and configure the Zed CLI properly before using these commands. This usually involves ensuring that the zed executable is in your system's PATH environment variable.