From a6baba1e30ba1a190513ede1e6c70b5e0d54798c Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 5 Apr 2022 23:47:18 +0200 Subject: [PATCH] Zsh: Use Gentoo packages for more plugins if possible Add support for zsh-async, fzf-tab and zsh-history-substring-search. --- .config/zsh/plugins.zsh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.config/zsh/plugins.zsh b/.config/zsh/plugins.zsh index 825b6de..26fa840 100644 --- a/.config/zsh/plugins.zsh +++ b/.config/zsh/plugins.zsh @@ -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