Files
dotfiles/zsh/lib/antidote.zsh
T

30 lines
1.2 KiB
Bash
Raw Normal View History

2026-07-27 10:55:58 +02:00
# Callers set plugins_txt and static_file before sourcing this module.
mkdir -p "${static_file:h}"
if [[ ! -e ${ZDOTDIR:-$HOME}/.antidote ]]; then
git clone https://github.com/mattmc3/antidote.git "${ZDOTDIR:-$HOME}/.antidote"
fi
# OMZ lib/plugins without oh-my-zsh.sh, which would set these up
ZSH_CACHE_DIR=${ZDOTDIR:-$HOME}/.cache/zsh/omz
[[ -d $ZSH_CACHE_DIR/completions ]] || mkdir -p "$ZSH_CACHE_DIR/completions"
fpath=("$ZSH_CACHE_DIR/completions" $fpath)
# ssh-agent plugin keys its env file on this; HOST changes with VPN rDNS
SHORT_HOST=${HOST/.*/}
if [[ $OSTYPE == darwin* ]] && _zsh_cached short_host \
/Library/Preferences/SystemConfiguration/preferences.plist -- scutil --get LocalHostName; then
read -r SHORT_HOST < $REPLY
fi
# OMZ calls compdef before compinit (last plugin) has run: queue, replay below
typeset -ga _compdef_queue
compdef() { _compdef_queue+=("${(j: :)${(@q)@}}") }
2026-07-27 10:55:58 +02:00
zstyle ':completion:*:ssh:*' hosts off
zstyle ':completion:*:scp:*' hosts off
zstyle ':completion:*:commands' rehash 1
source "${ZDOTDIR:-$HOME}/.antidote/antidote.zsh"
antidote load "$plugins_txt" "$static_file"
if (( ${+_comps} )); then
for _c in $_compdef_queue; do eval "compdef $_c"; done
unset _c _compdef_queue
fi