Improbe zsh's fpath handling

This commit is contained in:
Lockszmith (@kateryna) 2024-12-24 15:50:56 -05:00
parent 6ea5f89bb4
commit c8c218f860
1 changed files with 12 additions and 5 deletions

View File

@ -8,10 +8,17 @@ if [[ "${BASE_SHELL}" == "zsh" ]]; then
mkdir -p $ZSH_CACHE_DIR/completions
mkdir -p "$HOME/.local/share/zsh/completions"
[ -d "$HOME/.local/share/zsh/completions" ] && fpath=(
$HOME/.local/share/zsh/completions
$fpath
)
# Remove duplicates from fpath, and add local completion dir
fpath=( $(
for d in $(
awk '!seen[$0]++' <(
echo "$HOME/.local/share/zsh/completions"
printf '%s\n' $fpath
)
); do
[ -d "$d" ] && echo "$d"
done
) )
skip_global_compinit=1