README file from
GithubCopy as Zed Link
Select contents and link them into your agent panel in Zed.
Zed embeds a file:// link as context. With a line span in the URL fragment it attaches just that passage, without one the whole file, and with a trailing slash the whole folder. This plugin builds exactly that link and puts it on the clipboard:
[@My Note.md (122:123)](file:///home/me/vault/My%20Note.md#L122:123)
[@My Note.md](file:///home/me/vault/My%20Note.md)
[@Projects](file:///home/me/vault/Projects/)
Paste it into Zed's agent panel and the contents show up as an attachment rather than a bare link.
Usage
Make the vault part of the Zed project
In its current version, Zed resolves and embeds a mention through the open project, so a link from outside it fails with project path not found for file mention when linking files or folders. Add the vault to the project you work in via File → Add Folder to Project….
If you would rather not add it, insert the copied link with Paste as Plain Text instead — an agent with filesystem access should understand the raw format even without the embedding.
Use the right-click menu or the command palette
For a passage, select the lines, then either
- right-click in the editor and choose Copy as Zed link, or
- run the command Copy as Zed link from the command palette (assign a hotkey if you use it often).
Without a selection you get a one-line span, which Zed may not embed reliably — the plugin warns when that happens.
For a whole file or folder, either
- right-click it in the file explorer and choose Copy file as Zed link / Copy folder as Zed link, or
- run the command Copy whole file as Zed link for the note you are in.
Installation
Desktop only, since the link has to name a real path on disk.
Install from Settings → Community plugins → Browse, or, for a version that is not in the catalogue yet, point BRAT at Santuzius/copy-as-zed-link.
To install by hand, take main.js and manifest.json from the latest release and drop them into <vault>/.obsidian/plugins/copy-as-zed-link/.
License
MIT