diff --git a/.conduit.yaml b/.conduit.yaml index 5e461e7..bedbaac 100644 --- a/.conduit.yaml +++ b/.conduit.yaml @@ -29,10 +29,13 @@ - https://github.com/zsh-users/zsh-autosuggestions.git - https://github.com/zsh-users/zsh-history-substring-search.git - https://github.com/zsh-users/zsh-syntax-highlighting.git + - https://github.com/zsh-users/zsh-completions.git - https://github.com/junegunn/fzf.git - command: - fzf/install --bin - symlink: - {src: fzf/bin/fzf, dst: ~/.local/bin/fzf} - {src: fzf/bin/fzf-tmux, dst: ~/.local/bin/fzf-tmux} +- command: + - zsh update-completion-links.zsh - message: zsh will be the default prompt after next login diff --git a/update-completion-links.zsh b/update-completion-links.zsh new file mode 100755 index 0000000..80f4c33 --- /dev/null +++ b/update-completion-links.zsh @@ -0,0 +1,19 @@ +#!/usr/bin/env zsh + +# Check if third party completions are present. +local zsh_completions=~/.config/zsh/zsh-completions +[ ! -d $zsh_completions ] && return 0 + +# Loop over all completions. +for completion in $zsh_completions/src/_*; do + local name=`basename $completion` + local symlink=~/.local/share/zsh/site-functions/$name + # Remove existing completion file if it exists. + [ -f $symlink ] && rm $symlink + # Check if the command exists on the PATH. + if which ${name:1} &> /dev/null; then + # Symlink the completion for the existing command. + [ `uname` = Darwin ] && \ + ln -s $completion $symlink || ln -sr $completion $symlink + fi +done