- Go 75.3%
- Lua 21.8%
- Nix 2.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
cloud://all// lists the clouds, and each cloud lists its buckets as folders. Paths below a bucket map to the same objects as s3:// and gs:// URLs, so moves and copies between buckets of the same cloud stay server-side there. Copies between S3 and GCS go through a temporary local file. The provider now advertises copy_progressive, so yazi hands copies within it to the daemon instead of streaming them through the plugin. Previews download the hovered file, so they are disabled unless preview_max_mib is set through setup. |
||
| cmd/ycloud | ||
| internal | ||
| plugin/cloud.yazi | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
yazi-cloud
Browse and manage S3 (s3://bucket/key) and GCS (gs://bucket/key) buckets in yazi without mounting them.
It needs yazi 26.8 or later, which added custom VFS providers.
It consists of two parts:
ycloud, a Go daemon that keeps authenticated S3 and GCS clients alive, caches listings for 30 seconds and performs server-side copies and moves. The plugin talks to it throughycloud call, which starts the daemon on first use and restarts it when the binary changes. It exits after 30 minutes without requests.cloud.yazi, a Lua plugin that registerss3://andgs://as yazi VFS providers and adds previews, bucket pickers and URL copying.
Credentials are the ones the CLIs already use: the default AWS credential chain (including SSO profiles, AWS_PROFILE, AWS_REGION), and Google Application Default Credentials (gcloud auth application-default login).
Bucket regions are looked up automatically.
Listing GCS buckets uses GOOGLE_CLOUD_PROJECT, or the project from gcloud config when it is unset.
What works
- Browsing, with yazi's normal navigation, selection and visual mode.
- A browsable overview at
cloud://all//, with a folder per cloud and a subfolder per bucket.cloud://all//s3/bucket/keyis the same object ass3://bucket/key. - Copying, cutting and pasting within a bucket, done server-side. Inside the overview, this also holds between buckets of the same cloud, while copies between S3 and GCS go through a temporary local file.
- Copying and moving between local folders and buckets in both directions.
Between two
s3://orgs://URLs of different buckets the data streams through your machine, since yazi treats every bucket as a separate filesystem there. - Renaming, creating files and directories, and permanent deletion (
D, orremove --permanently). - Optional previews, which download the hovered file to
~/.cache/ycloud/objectsand hand it to yazi's usual previewers. They are disabled by default; see below. - Opening a file, which downloads it and opens the local copy with your usual opener. Edits to that copy are not uploaded back.
- Copying
s3://bucket/keyURLs of the selected or hovered files, also from inside the overview.
Limitations:
- Moving to the trash (
din the default keymap) fails, since object stores have no trash. - Object stores have no real directories.
Empty directories are kept as zero-byte
dir/marker objects, and renaming a directory copies and deletes every object below it. - Changes made outside yazi show up within 30 seconds, when the cached listing expires. The bucket lists in the overview are cached for 5 minutes.
- The overview folders and bucket roots are read-only: buckets cannot be created, renamed or deleted.
- yazi's own
copy url(cC) yieldss3://bucket//keywith a double slash, which is how yazi writes absolute virtual paths. Use the plugin'scopyaction instead.
Installation
The flake provides packages.<system>.cloud-yazi, the plugin with the path of ycloud built in, and packages.<system>.ycloud.
With home-manager:
programs.yazi.plugins.cloud = inputs.yazi-cloud.packages.${pkgs.system}.cloud-yazi;
Without Nix, build ycloud with go build ./cmd/ycloud, put it on your PATH, and copy plugin/cloud.yazi to ~/.config/yazi/plugins/.
Configuration
~/.config/yazi/vfs.toml registers the providers:
[s3."*"]
kind = "scope"
run = "cloud"
[gs."*"]
kind = "scope"
run = "cloud"
[cloud."*"]
kind = "scope"
run = "cloud"
~/.config/yazi/yazi.toml routes MIME detection, previews and opening of cloud files through the plugin:
[plugin]
prepend_fetchers = [
{ url = "s3://*", run = "cloud", prio = "high", group = "mime" },
{ url = "gs://*", run = "cloud", prio = "high", group = "mime" },
{ url = "cloud://*", run = "cloud", prio = "high", group = "mime" },
]
prepend_preloaders = [
{ url = "s3://*", run = "cloud" },
{ url = "gs://*", run = "cloud" },
{ url = "cloud://*", run = "cloud" },
]
prepend_previewers = [
{ url = "s3://*", run = "cloud" },
{ url = "gs://*", run = "cloud" },
{ url = "cloud://*", run = "cloud" },
]
[open]
prepend_rules = [
{ url = "s3://*", use = "cloud" },
{ url = "gs://*", use = "cloud" },
{ url = "cloud://*", use = "cloud" },
]
[opener]
cloud = [ { run = "ya emit plugin cloud open", desc = "Download and open" } ]
~/.config/yazi/keymap.toml adds the plugin's actions:
[[mgr.prepend_keymap]]
on = [ "g", "b" ]
run = "cd cloud://all//"
desc = "Browse all S3 and GCS buckets"
[[mgr.prepend_keymap]]
on = [ "g", "s" ]
run = "plugin cloud -- s3"
desc = "Open an S3 bucket"
[[mgr.prepend_keymap]]
on = [ "g", "S" ]
run = "plugin cloud -- gs"
desc = "Open a GCS bucket"
[[mgr.prepend_keymap]]
on = [ "c", "u" ]
run = "plugin cloud -- copy"
desc = "Copy s3:// or gs:// URL"
[[mgr.prepend_keymap]]
on = [ "c", "U" ]
run = "plugin cloud -- copy-dir"
desc = "Copy URL of the parent directory"
Previews download every hovered file up to a size limit, so they are off by default.
To enable them for files up to 20 MiB, add this to ~/.config/yazi/init.lua:
require("cloud"):setup { preview_max_mib = 20 }
The cached copies are reused while the object's size and modification time stay the same, and nothing prunes the cache.
The bucket pickers use fzf.
You can also start yazi in a bucket directly, as in yazi s3://my-bucket/some/prefix.
Troubleshooting
The daemon logs to ~/.cache/ycloud/daemon.log, including every failed request and every request slower than two seconds.
For yazi's side, run it with YAZI_LOG=debug and read ~/.local/state/yazi/yazi.log.
AWS_ENDPOINT_URL points the S3 client at an S3-compatible server, using path-style requests and the configured region.