Edit SOPS-encrypted YAML, JSON, and TOML in Zed via a plaintext sidecar. Zed has no virtual documents, so the decrypted buffer is a real file next to the original.
- Install the
sopsbinary and make sure it is onPATH(or setsopsPathbelow). - Install this extension in Zed.
- Optional user settings:
{
"lsp": {
"sops-lsp": {
"settings": {
"sopsPath": "/opt/homebrew/bin/sops",
"keyFile": "/Users/me/.ssh/keys/private/vleonov-key",
"autoEdit": true,
"autoEditAll": true,
"timeoutMs": 60000
}
}
}
}autoEditAll: true— auto-decrypt every SOPS YAML/JSON/TOML (not only.sops.yamlpath_regex). Sidecar tab should focus; Save re-encrypts; Close deletes the sidecar.keyFile— SSH identity for age-ssh (SOPS_AGE_SSH_PRIVATE_KEY_FILE). For a native age key file useenv.SOPS_AGE_KEY_FILE.autoEdit: falseturns auto-decrypt off even ifautoEditAllis true.- Code action remains SOPS: Edit decrypted (
cmd-.). Optional user keymap:{ "cmd-shift-e": "editor::ToggleCodeActions" }. The extension cannot bind a key to that action itself. - Status-bar
SOPS encryptedis a diagnostic, not a button.
- Open a SOPS-encrypted YAML/JSON/TOML file. A diagnostic appears:
SOPS encrypted. - Run the code action SOPS: Edit decrypted, or let auto-edit start a session (
autoEditAll, or a matching.sops.yamlcreation_rulesentry). - Edit the adjacent
.decrypted.<basename>sidecar. Supported Zed builds open and focus it through LSPwindow/showDocument; stable 1.19.2 and preview 1.20.0 show the filesystem path for manual opening. - Save the sidecar to re-encrypt the original. Only closing a managed sidecar removes it; opening other files does not end the session, and multiple sessions may coexist.
- Crash leftovers prompt for explicit recovery and are never silently deleted. Sidecars are created with mode
0600.
keyFile supplies SOPS_AGE_SSH_PRIVATE_KEY_FILE unless the explicit env entry supplies that variable. The .decrypted.* gitignore patterns remain defense in depth.
Add these patterns so plaintext sidecars are never committed:
.decrypted.*
*.decrypted.yaml
*.decrypted.yml
*.decrypted.json
*.decrypted.toml
*.decrypted.ini
If go-to-definition on YAML breaks, keep yaml-language-server ahead of sops-lsp:
{
"languages": {
"YAML": {
"language_servers": ["yaml-language-server", "sops-lsp"]
}
}
}