summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2019-08-30 16:50:20 +0200
committerAlan Pearce2019-08-30 16:50:20 +0200
commitd1605ba34ca569b64882a02e2948f16d4d94978e (patch)
tree5994e6cd6042e07b443952ec4913ab12f3f1241e
parent3ea4e2fe6b599958d1f17722613fa1b28bd4f7f3 (diff)
downloaddotfiles-d1605ba34ca569b64882a02e2948f16d4d94978e.tar.lz
dotfiles-d1605ba34ca569b64882a02e2948f16d4d94978e.tar.zst
dotfiles-d1605ba34ca569b64882a02e2948f16d4d94978e.zip
zsh: improve docker-compose setup
-rw-r--r--zsh/.config/zsh/.zshrc14
1 files changed, 13 insertions, 1 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index 9be59a1..c32daa6 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -77,6 +77,16 @@ bindkey '\e[3~' delete-char
 
 bindkey '\C-hd' describe-key-briefly
 
+dc () {
+  if [[ -x ./docker-compose ]]
+  then
+    ./docker-compose "$@"
+  else
+    docker-compose "$@"
+  fi
+}
+compdef '_dispatch docker-compose docker-compose' dc
+
 backward-argument () {
   local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
   zle backward-word
@@ -145,6 +155,8 @@ zplugin ice if'[[ $os -eq darwin ]]'
 zplugin snippet "OMZ::lib/functions.zsh"
 zplugin ice if'[[ $os -eq darwin ]]'
 zplugin snippet "OMZ::lib/termsupport.zsh"
+zplugin ice id-as'docker-compose-completion'
+zplugin snippet "https://github.com/docker/compose/raw/1.24.1/contrib/completion/zsh/_docker-compose"
 
 zplugin ice if'[[ $os -eq darwin ]]' wait'1' lucid
 zplugin load "unixorn/tumult.plugin.zsh"
@@ -255,6 +267,6 @@ fi
 
 unsetopt flow_control       # Let me use ^S and ^Q
 
-zplugin ice wait'1' if'[[ -z $SSH_CLIENT ]]' lucid #atinit'zpcompinit; zpcdreplay -q'
+zplugin ice wait'1' if'[[ -z $SSH_CLIENT ]]' lucid atinit'zpcompinit; zpcdreplay -q'
 zplugin load "zdharma/fast-syntax-highlighting"