ohmyzsh: not found /completions/_docker

Describe the bug

in archlinux already has this file https://github.com/ohmyzsh/ohmyzsh/issues/11753#issuecomment-1593124985 https://archlinux.org/packages/extra/x86_64/docker

/usr/share/zsh/site-functions/_docker

I added it to my .zshrc file source /usr/share/zsh/site-functions/_docker

but i still get the error not found /completions/_docker https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/docker/docker.plugin.zsh#L50

@carlosala What am I doing wrong?

Steps to reproduce

source /usr/share/zsh/site-functions/_docker

Expected behavior

not found /completions/_docker

Screenshots and recordings

No response

OS / Linux distribution

Arch Linux

Zsh version

5.9

Terminal emulator

kitty

If using WSL on Windows, which version of WSL

None

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Same issue here using an external plugin manager (antidote), as @akimdi.

ZSH_CACHE_DIR variable is not usually set by plugin managers. I’ve added this as a workaround to my zshrc before loading omz:

# Set omz variables prior to loading omz plugins
ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
mkdir -p $ZSH_CACHE_DIR/completions

Nevertheless, docker is not the only plugin affected: a quick grep of >| "$ZSH_CACHE_DIR/completions/ in the plugins folder of this repo shows 22 of them.

docker completion zsh dumps this out:

#compdef docker
compdef _docker docker

# zsh completion for docker                               -*- shell-script -*-

__docker_debug()
{
    local file="$BASH_COMP_DEBUG_FILE"
    if [[ -n ${file} ]]; then
        echo "$*" >> "${file}"
    fi
}

_docker()
{
<snip>

Opening new terminal/reloading zshrc or logging out and back in does not help.

As mentioned in the SO question linked to above, there are some completions that display in the newer version of the plugin, but not all of them, and none with subcommand descriptions like the older version of the docker plugin displayed. The newer plugin is loading and does something, but not nearly as well as the older version.

Also, if the older version of the plugin worked 100% and the newer version does not work as well for the same user and same exact configuration, I think it’s safe to say the newer version of the docker plugin has a bug.