0
0

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 3 years have passed since last update.

[zsh]補完機能を有効化する[Docker]

Posted at

##成功:oh-my-zshから設定
https://matsuand.github.io/docs.docker.jp.onthefly/compose/completion/#zsh

自分の環境ではoh-my-zsh シェルがあったため、下記設定で対応

~/.zshrc
plugins=(... docker docker-compose
)
~/.zshrc
~~抜粋ここから~~
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git heroku docker docker-compose)

source $ZSH/oh-my-zsh.sh
~~抜粋ここまで~~

viなどで編集後、ターミナル再起動もしくは再読込

yutakaf@mi  ~/Desktop/git  docker ...
attach     -- Attach local standard input, output, and error streams to a running container
build      -- Build an image from a Dockerfile
builder    -- Manage builds
commit     -- Create a new image from a container's changes
config     -- Manage Docker configs
container  -- Manage containers
context    -- Manage contexts
cp         -- Copy files/folders between a container and the local filesystem
~~以下続く~~

タブでコマンドが補完されるようになった。

##失敗
https://docs.docker.jp/compose/completion.html#zsh
dockerのこっちのやり方だとうまくいかなかった。

コマンド補完自体はできるのだが、ディレクトリ補完が先に働き、うまく機能しなかった。

mkdir -p ~/.zsh/completion
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit && compinit -i
exec $SHELL -l

###経緯
Docker学習に伴い、作業した。
macOS High SierraにDockerをインストールする。【旧バージョン】

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?