Zsh: Don't run antibody if we don't need it

This commit is contained in:
tastytea 2022-04-05 16:33:38 +02:00
parent 98a36aa78c
commit 806f31c85d
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
2 changed files with 7 additions and 4 deletions

View File

@ -56,7 +56,7 @@ for plugin in "${(@s/ /)ZSH_PLUGIN_DIST}"; do
[[ -n "${plugin}" ]] && source "${plugin}"
done
unset plugin
source "${ZSH_PLUGIN_SOURCE}"
[[ -n "${ZSH_PLUGIN_SOURCE}" ]] && source "${ZSH_PLUGIN_SOURCE}"
# Fuzzy finder, <https://github.com/junegunn/fzf>.
export FZF_CTRL_R_OPTS="--layout=reverse"

View File

@ -14,10 +14,12 @@ local -a _my_plugins=(
# Must come after zsh-syntax-highlighting
zsh-users/zsh-history-substring-search
)
if ! command -v fzf > /dev/null; then
# Don't load these plugins if fzf was not found
_my_plugins=(${_my_plugins:#Aloxaf/fzf-tab})
fi
if [[ "$HOST" == "steuerbeamter" ]]; then
# Don't load these plugins on slow computers
_my_plugins=(${_my_plugins:#zsh-users/zsh-autosuggestions})
@ -40,10 +42,11 @@ if [[ -f /etc/gentoo-release ]]; then
fi
export ZSH_PLUGIN_DIST="${_my_plugins_dist}" # Arrays can not be exported
zmodload zsh/stat
zmodload zsh/datetime
# If there are plugins not handled by the package manager, use antibody
if [[ -n ${_my_plugins} ]] && command -v antibody > /dev/null; then
zmodload zsh/stat
zmodload zsh/datetime
if command -v antibody > /dev/null; then
local plugin_cache_dir="$(antibody home)"
export ZSH_PLUGIN_SOURCE="${plugin_cache_dir}/antibody-plugins.zsh"