Skip to content

cf complete zsh >> .zshrc fails on vanilla zsh #340

Closed

Description

@couetilc

Summary of the issue

I use vanilla zsh on my macbook. Nothing in the .zshrc. When I try to install the cf completion script for zsh, I get the following error.

% zsh -f -c "$(cf complete zsh)"
zsh:2: command not found: compdef
%

Current workaround: initialize completions only if compdef is unavailable.

if (( ! $+functions[compdef] )); then
  autoload -Uz compinit
  compinit
fi

eval "$(cf complete zsh)"

Expected behaviour

I expect the generated completion script to work when sourced in an unconfigured Zsh shell.

Version of cf used

1.0.0-beta.18

System information and package versions

  System:
    OS: macOS 26.6.2
    CPU: (14) arm64 Apple M4 Pro
    Memory: 5.64 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 26.12.0 - /opt/homebrew/bin/node
    npm: 11.20.0 - /opt/homebrew/bin/npm
$ zsh --version
zsh 5.9 (arm64-apple-darwin25.0)

Reproduction (optional)

% cf complete zsh >> .vanilla.zshrc
% RCS=.vanilla.zshrc  zsh 

Possible Fix

if (( ! $+functions[compdef] )); then
  autoload -Uz compinit
  compinit
fi

Activity

  1. couetilc commented on Oct 17, 2026

    @couetilc
    Author

    Realized this is from a dependency, @bomb.sh/tab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions