feat(zsh): complete chezmoi edit with managed source files#313
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 theeditsubcommand, so zsh defaults to completing every path under the filesystem. Sinceeditonly 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 theeditsubcommand — offeringchezmoi managed --path-style=absolute --include=files,symlinks— and defers every other subcommand to the real_chezmoicompletion. Flag completion (chezmoi edit -<TAB>) still passes through to_chezmoi.🤖 Generated with Claude Code