9
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

201811現在のzshのdockerコマンド補完について

Last updated at Posted at 2018-11-20

ネットでは

dockerのzsh補完として有名なレポジトリであるfelixr/docker-zsh-completionがあるが、実はもうメンテされていない。
めでたい事に、本家のdocker/cliに吸収されたようだ。

Deprecation notice: This repository is not kept up-to-date any more. Please, switch to the ZSH completion from Docker directly.

余談だが、zshの性として1枚の補完ファイルにするのが必須のため、3000行を超えるとんでもない巨大なファイルに成長していることが印象的・・・。

使い方

普通にfpathに入れたければfpath配下におけば良い
例えば~/.zsh/completionを新たにfpathとして設定しようとすれば、

$ mkdir -p ~/.zsh/completion
$ curl -L https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker > ~/.zsh/completion/_docker
$ fpath=(~/.zsh/completion $fpath)
$ exec zsh

とでもすればいい。

前みたいにzplugで設定したい。

前みたいに単体で管理されてないためdocker/cliごと持ってくる必要あると思うが、一応レポジトリ、そしてzplugとして管理したいのであれば無理やりやればいいと思う。

zplug "docker/cli", use:"contrib/completion/zsh/_docker"

lazy:true は設定しておく事をオススメしたい。

9
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?