1
0
Fork 0

zsh: switch to antidote

This commit is contained in:
tastytea 2024-04-18 20:47:16 +02:00
parent 3f787981bc
commit 96c477972e
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 8 additions and 7 deletions

View File

@ -68,13 +68,14 @@ if [[ -n ${_my_plugins_dist} ]]; then
fi fi
[[ -z ${_my_plugins} ]] && return [[ -z ${_my_plugins} ]] && return
# If there are plugins not handled by the package manager, use antibody # If there are plugins not handled by the package manager, use antidote
if command -v antibody > /dev/null; then zstyle ':antidote:compatibility-mode' 'antibody' # TODO: switch to native mode
if command -v antidote > /dev/null; then
zmodload zsh/stat zmodload zsh/stat
zmodload zsh/datetime zmodload zsh/datetime
local plugin_cache_dir="$(antibody home)" local plugin_cache_dir="$(antidote home)"
export ZSH_PLUGIN_SOURCE="${plugin_cache_dir}/antibody-plugins.zsh" export ZSH_PLUGIN_SOURCE="${plugin_cache_dir}/antidote-plugins.zsh"
if [[ -f "${ZSH_PLUGIN_SOURCE}" ]] \ if [[ -f "${ZSH_PLUGIN_SOURCE}" ]] \
&& [[ $(zstat +size "${ZSH_PLUGIN_SOURCE}") -ne 0 ]]; then && [[ $(zstat +size "${ZSH_PLUGIN_SOURCE}") -ne 0 ]]; then
@ -83,17 +84,17 @@ if command -v antibody > /dev/null; then
# Update plugins every 10 days # Update plugins every 10 days
if [[ $(( ${_now} - ${_plugins_modified} - 60 * 60 * 24 * 10)) -gt 0 ]]; then if [[ $(( ${_now} - ${_plugins_modified} - 60 * 60 * 24 * 10)) -gt 0 ]]; then
print "\e[3;95mUpdating plugins…\e[0m" print "\e[3;95mUpdating plugins…\e[0m"
antibody update --parallelism=$(nproc --ignore=1) \ antidote update --parallelism=$(nproc --ignore=1) \
&& touch "${ZSH_PLUGIN_SOURCE}" && touch "${ZSH_PLUGIN_SOURCE}"
fi fi
else else
print "\e[3;95mInstalling plugins…\e[0m" print "\e[3;95mInstalling plugins…\e[0m"
mkdir -p "${plugin_cache_dir}" mkdir -p "${plugin_cache_dir}"
antibody bundle --parallelism=$(nproc --ignore=1) \ antidote bundle --parallelism=$(nproc --ignore=1) \
<<<$(print -l ${_my_plugins}) > "${ZSH_PLUGIN_SOURCE}" <<<$(print -l ${_my_plugins}) > "${ZSH_PLUGIN_SOURCE}"
fi fi
else else
print -u 2 "\e[7;95mantibody not found.\e[0m" print -u 2 "\e[7;95mantidote not found.\e[0m"
fi fi
} }