1
0
Fork 0

Zsh: Organise plugins in an array

This commit is contained in:
tastytea 2022-04-04 19:46:48 +02:00
parent f37ca08d78
commit 09c6315836
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 16 additions and 15 deletions

View File

@ -43,14 +43,21 @@ export EDITOR="${VISUAL}"
zmodload zsh/stat
zmodload zsh/datetime
if command -v fzf > /dev/null; then
# Only load these plugins if fzf was found.
local _depends_on_fzf="Aloxaf/fzf-tab"
local -a _my_plugins=(
mafredri/zsh-async
Aloxaf/fzf-tab
zsh-users/zsh-autosuggestions
zsh-users/zsh-syntax-highlighting
# 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 on slow computers
local _heavy_plugins="zsh-users/zsh-autosuggestions"
if [[ "$HOST" == "steuerbeamter" ]]; then
# Don't load these plugins on slow computers
_my_plugins=(${_my_plugins:#zsh-users/zsh-autosuggestions})
fi
if command -v antibody > /dev/null; then
@ -70,14 +77,8 @@ if command -v antibody > /dev/null; then
else
print "\e[3;95mInstalling plugins…\e[0m"
mkdir -p "${plugin_cache_dir}"
antibody bundle --parallelism=$(nproc --ignore=1) <<EOF > "${ZSH_PLUGIN_SOURCE}"
${_depends_on_fzf}
${_heavy_plugins}
mafredri/zsh-async
zsh-users/zsh-syntax-highlighting
# Must come after zsh-syntax-highlighting
zsh-users/zsh-history-substring-search
EOF
antibody bundle --parallelism=$(nproc --ignore=1) \
<<<$(print -l ${_my_plugins}) > "${ZSH_PLUGIN_SOURCE}"
fi
else
print -u 2 "\e[7;95mantibody not found.\e[0m"