Skip to content

Commit

Permalink
zsh: Remove FPATH and add back explicit sourcing of completions
Browse files Browse the repository at this point in the history
Turns out FPATH didn't work as I expected, and I can't figure out how to
actually make completions be sourced automatically right now.
  • Loading branch information
lindhe committed Jan 9, 2025
1 parent 85cb1e4 commit ea04272
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ bindkey '^[M' '_toggle_md_mode'
# Create completions directory
USER_COMPLETIONS_DIR="${HOME}/.config/zsh/completions"
mkdir -p "${USER_COMPLETIONS_DIR:?}"
export FPATH="${FPATH}:${USER_COMPLETIONS_DIR:?}"

# x completion zsh
autocompletions=(
Expand Down Expand Up @@ -263,6 +262,21 @@ for cmd in "${autocompletions[@]}"; do
fi
done

# Autocompletions from disk
if [[ -d "${USER_COMPLETIONS_DIR}" ]]; then
if [[ ! $(find "${USER_COMPLETIONS_DIR}" -maxdepth 0 -empty) ]]; then
for f in "${USER_COMPLETIONS_DIR}"/*; do
if [[ -f ${f} ]]; then
source "${f}"
else
echo "Unable to source '${f}'" 1>&2
fi
done
fi
else
echo "ERROR: ${USER_COMPLETIONS_DIR} does not exist!" 2>&1
fi

# }}}

############################### VS Code ###############################
Expand Down

0 comments on commit ea04272

Please sign in to comment.