mkdir -p ~/.oh-my-zsh/plugins/docker/
curl -fLo ~/.oh-my-zsh/plugins/docker/_docker https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker
- Add
docker
toplugins
section in~/.zshrc
exec zsh
Created
August 13, 2017 02:12
-
-
Save ro31337/b2c33ad0b90636e9e3bb76fb4fb76907 to your computer and use it in GitHub Desktop.
Zsh docker completion
Thank you very much!
thank you
Many thanks. Awesome.
Worked. Thanks!!
It's works! Thank You.
does not work for me...
MAgic 😎👍
does not work for me...
same, adn that's weird because it worked on my previous laptop but the new one nope
this works
Tnx You ❤️
Amazing... Thanks!
Thank you ❤️
thx, perfectly worked!
thanks!
Still working as of December 2023 <3
Cool
I don't use oh-my-zsh. Below worked for me:
curl -fLo /usr/local/share/zsh/site-functions/_docker https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker
exec zsh
First of all, thanks. I want it to add the plugin in one command, so this one adds it to the end of the list.
sed -i 's/\(^plugins=(.*\)\()$\)/\1 docker\2/' ~/.zshrc
Longer explanation
# ADD THE PLUGIN TO ~/.zshrc IN THE PLUGINS SECTION
# - ADD AT THE START OF LIST (AFTER THE OPEN PARENTHESIS)
# sed -i 's/plugins=(/plugins=(docker /' ~/.zshrc
# - ADD AT THE END OF THE LIST VERSION (BEFORE CLOSING PARENTHESIS)
sed -i 's/\(^plugins=(.*\)\()$\)/\1 docker\2/' ~/.zshrc
# 's/ > Default sed substitution start
# \(^plugins=(.*\) > Captures as $1, in a line starting with 'plugins=(', everything BEFORE the closing ')'
# \()$\) > Captures as $2, the closing ')'
# /\1 docker\2/' > Replaces the whole line with $1 + ' docker' + $2
# FOR EXAMPLE, AN ORIGINAL LINE IN ~/.zshrc > "plugins=(git)"
# APPLYING THE SED COMMAND >
# $1: 'plugins=(git'
# Add: ' docker'
# $2: ')'
# RESULT > 'plugins=(git docker)'
# TO TEST WITHOUT SUBSTITUTION
# sed 's/\(^plugins=(.*\)\()$\)/\1 docker\2/' ~/.zshrc | grep -E '^plugins='
# EXPLANATION FOR SED'S PARTS FROM https://stackoverflow.com/a/14137448/30293736
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you ❤️