forked from openkylin/platform_build
Don't override zsh users' compinit options.
I call "compinit -i" in my .zshrc, to allow loading autocompletion from "unsafe" locations. envsetup.sh breaks that. Change behavior to only call compinit if bash-style completion is not already enabled. This is a minimal fix; an alternative would be to rely on the user to call 'bashcompinit' in their .zshrc instead, and just skip all autocomplete functionality if they don't. Test: manual - source ./envsetup.sh in {bash, zsh, zsh -f} and test completion for lunch Change-Id: Ibb10eb68a96d69c19b9db9b21e0546fe8ae299b2
This commit is contained in:
parent
0e91bac015
commit
df248e60e5
11
envsetup.sh
11
envsetup.sh
|
@ -1574,9 +1574,12 @@ function atest()
|
|||
}
|
||||
|
||||
# Zsh needs bashcompinit called to support bash-style completion.
|
||||
function add_zsh_completion() {
|
||||
autoload -U compinit && compinit
|
||||
autoload -U bashcompinit && bashcompinit
|
||||
function enable_zsh_completion() {
|
||||
# Don't override user's options if bash-style completion is already enabled.
|
||||
if ! declare -f complete >/dev/null; then
|
||||
autoload -U compinit && compinit
|
||||
autoload -U bashcompinit && bashcompinit
|
||||
fi
|
||||
}
|
||||
|
||||
function validate_current_shell() {
|
||||
|
@ -1587,7 +1590,7 @@ function validate_current_shell() {
|
|||
;;
|
||||
*zsh*)
|
||||
function check_type() { type "$1"; }
|
||||
add_zsh_completion ;;
|
||||
enable_zsh_completion ;;
|
||||
*)
|
||||
echo -e "WARNING: Only bash and zsh are supported.\nUse of other shell would lead to erroneous results."
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue