mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
[Fix] bash_completion
: check if compinit
is called before calling it
Fixes #2489.
This commit is contained in:
parent
07253ecd51
commit
117486d4a7
@ -84,12 +84,15 @@ __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.
|
||||
# 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user