Zsh: Use Gentoo packages for more plugins if possible

Add support for zsh-async, fzf-tab and zsh-history-substring-search.
This commit is contained in:
tastytea 2022-04-05 23:47:18 +02:00
parent 806f31c85d
commit a6baba1e30
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -8,6 +8,7 @@ setopt LOCAL_OPTIONS EXTENDED_GLOB
local -a _my_plugins=(
mafredri/zsh-async
zsh-users/zsh-completions
# Must come before autosuggestions and syntax-highlighting
Aloxaf/fzf-tab
zsh-users/zsh-autosuggestions
zsh-users/zsh-syntax-highlighting
@ -28,16 +29,29 @@ fi
local -a _my_plugins_dist
# Don't load plugins that are installed by the package manager
if [[ -f /etc/gentoo-release ]]; then
local _gentoo_plugin_dir="/usr/share/zsh/site-functions"
if [[ -d /var/db/pkg/app-shells/zsh-async-*(#qN) ]]; then
_my_plugins=(${_my_plugins:#mafredri/zsh-async})
_my_plugins_dist+=(${_gentoo_plugin_dir}/async.zsh)
fi
if [[ -d /var/db/pkg/app-shells/zsh-completions-*(#qN) ]]; then
_my_plugins=(${_my_plugins:#zsh-users/zsh-completions})
fi
if [[ -d /var/db/pkg/app-shells/fzf-tab-*(#qN) ]]; then
_my_plugins=(${_my_plugins:#Aloxaf/fzf-tab})
_my_plugins_dist+=(${_gentoo_plugin_dir}/fzf-tab.zsh)
fi
if [[ -d /var/db/pkg/app-shells/zsh-autosuggestions-*(#qN) ]]; then
_my_plugins=(${_my_plugins:#zsh-users/zsh-autosuggestions})
_my_plugins_dist+=(/usr/share/zsh/site-functions/zsh-autosuggestions.zsh)
_my_plugins_dist+=(${_gentoo_plugin_dir}/zsh-autosuggestions.zsh)
fi
if [[ -d /var/db/pkg/app-shells/zsh-syntax-highlighting-*(#qN) ]]; then
_my_plugins=(${_my_plugins:#zsh-users/zsh-syntax-highlighting})
_my_plugins_dist+=(/usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh)
_my_plugins_dist+=(${_gentoo_plugin_dir}/zsh-syntax-highlighting.zsh)
fi
if [[ -d /var/db/pkg/app-shells/zsh-history-substring-search-*(#qN) ]]; then
_my_plugins=(${_my_plugins:#zsh-users/zsh-history-substring-search})
_my_plugins_dist+=(${_gentoo_plugin_dir}/zsh-history-substring-search.zsh)
fi
fi
export ZSH_PLUGIN_DIST="${_my_plugins_dist}" # Arrays can not be exported