README.md 1.13 KB
Newer Older
Marc Cornellà's avatar
Marc Cornellà committed
1
# Docker plugin
Ahmed Aeon Axan's avatar
Ahmed Aeon Axan committed
2

Marc Cornellà's avatar
Marc Cornellà committed
3
This plugin adds auto-completion for [docker](https://www.docker.com/).
4
5

To use it add `docker` to the plugins array in your zshrc file.
6

7
8
9
10
```zsh
plugins=(... docker)
```

Marc Cornellà's avatar
Marc Cornellà committed
11
12
A copy of the completion script from the docker/cli git repo:
https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

## Settings

By default, the completion doesn't allow option-stacking, meaning if you try to
complete `docker run -it <TAB>` it won't work, because you're _stacking_ the
`-i` and `-t` options.

[You can enable it](https://github.com/docker/cli/commit/b10fb43048) by **adding
the lines below to your zshrc file**, but be aware of the side effects:

> This enables Zsh to understand commands like `docker run -it
> ubuntu`. However, by enabling this, this also makes Zsh complete
> `docker run -u<tab>` with `docker run -uapprox` which is not valid. The
> users have to put the space or the equal sign themselves before trying
> to complete.
>
> Therefore, this behavior is disabled by default. To enable it:
>
> ```
> zstyle ':completion:*:*:docker:*' option-stacking yes
> zstyle ':completion:*:*:docker-*:*' option-stacking yes
> ```