feat: e opens a repo's SOPS or .env file, in nvim, sops edit or your editor #1

Merged
keb merged 3 commits from feat/edit-files into main 2026-10-11 09:34:05 +02:00
Owner

e on a file in a repo opens it; on a secret, it opens the file at that key's line.

  • SOPS files: sops edit in the terminal, then back to lazysecrets with the keys reloaded. Exit 200 (nothing changed) shows "unchanged".
  • Other files inside nvim ($NVIM set): lazysecrets asks that nvim, over --remote-expr, to open the file once lazysecrets' terminal closes, then quits. The file lands in the window you came from, not the closing float. Started from a shell in a terminal, it opens in the previous window straight away. No change to the nvim plugin is needed.
  • Otherwise: $VISUAL/$EDITOR in the terminal (with +N, file:N or -g file:N for editors that take a line), else the system default app.

The repo provider now records each key's line (YAML node lines, env/ini line numbers) behind a new optional provider.Files interface. Other providers show "only SOPS and .env files in repos can be opened".

The nvim handoff was tested against a headless nvim 0.12: a floating terminal closed on exit the way snacks does, and a shell in a split. A file name with a space and a quote opened at the right line in both. Unit tests cover lines per format, the nvim, sops and default-app paths, and the editor line arguments.

Note: e is a new default key, so a config that already binds e to something else now gets the "bound to both" error, until one of them is rebound.

🤖 Generated with Claude Code

`e` on a file in a repo opens it; on a secret, it opens the file at that key's line. - **SOPS files**: `sops edit` in the terminal, then back to lazysecrets with the keys reloaded. Exit 200 (nothing changed) shows "unchanged". - **Other files inside nvim** (`$NVIM` set): lazysecrets asks that nvim, over `--remote-expr`, to open the file once lazysecrets' terminal closes, then quits. The file lands in the window you came from, not the closing float. Started from a shell in a terminal, it opens in the previous window straight away. No change to the nvim plugin is needed. - **Otherwise**: `$VISUAL`/`$EDITOR` in the terminal (with `+N`, `file:N` or `-g file:N` for editors that take a line), else the system default app. The repo provider now records each key's line (YAML node lines, env/ini line numbers) behind a new optional `provider.Files` interface. Other providers show "only SOPS and .env files in repos can be opened". The nvim handoff was tested against a headless nvim 0.12: a floating terminal closed on exit the way snacks does, and a shell in a split. A file name with a space and a quote opened at the right line in both. Unit tests cover lines per format, the nvim, sops and default-app paths, and the editor line arguments. Note: `e` is a new default key, so a config that already binds `e` to something else now gets the "bound to both" error, until one of them is rebound. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
keb added 1 commit 2026-10-11 00:09:55 +02:00
feat: e opens a repo's SOPS or .env file, in nvim, sops edit or your editor
CI / Checks (pull_request) Successful in 26s
PR title / Conventional title (pull_request) Successful in 1s
c29319b821
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
keb added 1 commit 2026-10-11 00:25:01 +02:00
feat: start sops edit on the key's line
CI / Checks (pull_request) Successful in 25s
PR title / Conventional title (pull_request) Successful in 1s
10c2362482
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
keb added 1 commit 2026-10-11 00:29:01 +02:00
fix: open the file in nvim when the terminal plugin wipes its buffer
CI / Checks (pull_request) Successful in 24s
PR title / Conventional title (pull_request) Successful in 1s
98f597ffae
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
keb merged commit 17d2705e12 into main 2026-10-11 09:34:05 +02:00
keb deleted branch feat/edit-files 2026-10-11 09:34:05 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: keb/lazysecrets#1