Zsh Docker Plugin not Working

2019-04-24 23:03发布

I have been using oh-my-zsh for a while now and the docker plugin as recently stopped working for me for some reason.

I checked my ~/.zshrc file and the plugin is included

plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting docker)

I checked the ~/.oh-my-zsh/plugins/docker directory and there is a _docker file in there. Yet when I type docker and press Tab, I get none of the autocomplete shortcuts that I used to get.

I can confirm that my git plugin works just fine but not the docker plugin. Tried doing exec zsh and source ~/.zshrc and restarted my terminal but no luck.

Am I missing something?

4条回答
Bombasti
2楼-- · 2019-04-24 23:22

I think you may be missing ,'s in between each plugin.

plugins=(git, colored-man, colorize, github, jira, vagrant, virtualenv, pip, python, brew, osx, zsh-syntax-highlighting, docker)

Alternatively you can place each plugin on a separate line:

plugins=(
  git
  colored-man
  colorize 
  github
  jira
  vagrant
  virtualenv
  pip
  python
  brew
  osx
  zsh-syntax-highlighting 
  docker
)
查看更多
再贱就再见
3楼-- · 2019-04-24 23:34

Follow these steps if you are using oh-my-zsh and autocomplete is not working:

Step 1:

Make the following three links:

ln -s /Applications/Docker.app/Contents/Resources/etc/docker.zsh-completion /usr/local/share/zsh/site-functions/_docker

ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.zsh-completion /usr/local/share/zsh/site-functions/_docker-machine

ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.zsh-completion /usr/local/share/zsh/site-functions/_docker-compose

Step 2:

Either add autoload -Uz compinit; compinit to .zshrc

or run echo "autoload -Uz compinit; compinit" >> .zshrc in your shell

查看更多
爷的心禁止访问
4楼-- · 2019-04-24 23:37

It seems oh-my-zsh is not loading plugins/docker/_docker file. You must add it to ~/.zshrc in an another way. Add these lines to your ~/.zshrc file:

fpath+=($ZSH/plugins/docker)
autoload -U compinit && compinit
查看更多
闹够了就滚
5楼-- · 2019-04-24 23:45

You might want to try and remove any '.zcompdump-(...) files you might have on your user's home directory. See this

Then see if it works.

查看更多
登录 后发表回答