Skip to content

feat(zsh): complete chezmoi edit with managed source files#313

Merged
laurigates merged 2 commits into
mainfrom
feat/chezmoi-edit-completion
Jul 10, 2026
Merged

feat(zsh): complete chezmoi edit with managed source files#313
laurigates merged 2 commits into
mainfrom
feat/chezmoi-edit-completion

Conversation

@laurigates

Copy link
Copy Markdown
Owner

What

Make chezmoi edit <TAB> complete only files/symlinks tracked in the chezmoi source directory, instead of falling back to whole-filesystem completion.

Why

chezmoi's own cobra completion returns :0 (no completions) for the edit subcommand, so zsh defaults to completing every path under the filesystem. Since edit only accepts managed source targets, this is noisy and lets you tab to files chezmoi can't edit.

How

A wrapper compdef (_chezmoi_edit_managed) special-cases the edit subcommand — offering chezmoi managed --path-style=absolute --include=files,symlinks — and defers every other subcommand to the real _chezmoi completion. Flag completion (chezmoi edit -<TAB>) still passes through to _chezmoi.

🤖 Generated with Claude Code

laurigates and others added 2 commits July 8, 2026 14:33
…dest

Merging PRs in creation order is a safer bet for clean rebase/squash
merges. Sorts the shared multi-select PR list by createdAt ascending
and swaps --tac for --layout=reverse so the cursor starts on the
oldest PR at the top, matching the sort direction.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019qiQLB35RH1xQ5gd8f9npF
chezmoi's cobra completion returns nothing for `edit`, so `chezmoi edit
<TAB>` falls back to whole-filesystem completion. Add a wrapper compdef
that offers only files/symlinks tracked in the source dir (via `chezmoi
managed`), deferring all other subcommands to the real _chezmoi.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gq2w8A1vhNjdtG8bH8hqbT
@laurigates laurigates merged commit 9ae7b86 into main Jul 10, 2026
8 checks passed
@laurigates laurigates deleted the feat/chezmoi-edit-completion branch July 10, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant