Skip to content

Commit

Permalink
GH-2489 check if compinit is called before calling it
Browse files Browse the repository at this point in the history
  • Loading branch information
akefirad committed Apr 16, 2021
1 parent 07253ec commit fcb51be
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@ __nvm() {
# called bashcompinit that will create a complete in ZSH. If the user is in
# ZSH, load and run bashcompinit before calling the complete function.
if [[ -n ${ZSH_VERSION-} ]]; then
# Calling compinit first and then bashcompinit as mentioned by zsh man page.
autoload -U +X compinit && if [[ ${ZSH_DISABLE_COMPFIX-} = true ]]; then
compinit -u
else
compinit
# First calling compinit (only if not called yet!)
# and then bashcompinit as mentioned by zsh man page.
if ! command -v compinit > /dev/null; then
autoload -U +X compinit && if [[ ${ZSH_DISABLE_COMPFIX-} = true ]]; then
compinit -u
else
compinit
fi
fi
autoload -U +X bashcompinit && bashcompinit
fi
Expand Down

0 comments on commit fcb51be

Please sign in to comment.