Skip to content

Commit

Permalink
make pugin-load fully compatible with system's plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
bepoli committed Aug 8, 2024
1 parent 17599e6 commit 3fdb01f
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if [ -x "$(command -v micromamba)" ]; then
fi

# source other config files
for f in "${XDG_CONFIG_HOME:-$HOME/.config}/shell"/*.(sh|zsh); do
for f in "${XDG_CONFIG_HOME:-$HOME/.config}"/shell/*.(sh|zsh); do
source "$f"
done
unset f
Expand All @@ -82,18 +82,17 @@ function plugin-load {
fi
done
if [[ ! -d "$plugdir" ]]; then
echo "Cloning $repo..."
git clone -q --depth 1 --recursive --shallow-submodules \
https://github.com/$repo $plugdir
fi
initfile=$plugdir/${repo:t}.plugin.zsh
if [[ ! -e $initfile ]]; then
initfiles=($plugdir/*.{plugin.zsh,zsh-theme,zsh,sh}(N))
(( $#initfiles )) || {echo >&2 "No init file found '$repo'." && continue}
ln -sf $initfiles[1] $initfile
printf "Clone $repo ? [yN]"
if read -q; then
git clone -q --depth 1 --recursive --shallow-submodules \
https://github.com/"$repo" "$plugdir"
else
continue
fi
fi
fpath+="$plugdir"
(( $+functions[zsh-defer] )) && zsh-defer . $initfile || . $initfile
initfiles=($plugdir/*.{plugin.zsh,zsh-theme,zsh,sh}(N))
(( $#initfiles )) || {echo >&2 "No init file found '$repo'." && continue}
source $initfiles[1]
done
}
plugin-load zsh-users/zsh-autosuggestions
Expand Down

0 comments on commit 3fdb01f

Please sign in to comment.