mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
move source guard to the outer script
This commit is contained in:
parent
99bc7f3c7f
commit
5e72d3ca80
2 changed files with 35 additions and 30 deletions
|
@ -27,13 +27,6 @@ if ! autoload -U is-at-least || ! is-at-least 5.1; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( $+_P9K_SOURCED )); then
|
|
||||||
prompt_powerlevel9k_setup
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly _P9K_SOURCED=1
|
|
||||||
|
|
||||||
source "${_p9k_installation_dir}/functions/utilities.zsh"
|
source "${_p9k_installation_dir}/functions/utilities.zsh"
|
||||||
source "${_p9k_installation_dir}/functions/icons.zsh"
|
source "${_p9k_installation_dir}/functions/icons.zsh"
|
||||||
source "${_p9k_installation_dir}/functions/colors.zsh"
|
source "${_p9k_installation_dir}/functions/colors.zsh"
|
||||||
|
|
|
@ -20,14 +20,23 @@
|
||||||
#zstyle ':vcs_info:*+*:*' debug true
|
#zstyle ':vcs_info:*+*:*' debug true
|
||||||
#set -o xtrace
|
#set -o xtrace
|
||||||
|
|
||||||
'builtin' 'typeset' "_p9k_aliases=$(
|
() {
|
||||||
|
'builtin' 'emulate' '-L' 'zsh'
|
||||||
|
|
||||||
|
'builtin' 'local' "_p9k_aliases=$(
|
||||||
'builtin' 'alias' '-rL'
|
'builtin' 'alias' '-rL'
|
||||||
'builtin' 'alias' '-gL'
|
'builtin' 'alias' '-gL'
|
||||||
'builtin' 'alias' '-sL')"
|
'builtin' 'alias' '-sL')"
|
||||||
|
|
||||||
'builtin' 'unalias' '-m' '*'
|
'builtin' 'unalias' '-m' '*'
|
||||||
|
|
||||||
_p9k_installation_dir=''
|
{
|
||||||
|
if (( $+_p9k_sourced )); then
|
||||||
|
prompt_powerlevel9k_setup
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
typeset -gr _p9k_sourced=1
|
||||||
|
typeset -g _p9k_installation_dir=''
|
||||||
|
|
||||||
if [[ -n $POWERLEVEL9K_INSTALLATION_DIR ]]; then
|
if [[ -n $POWERLEVEL9K_INSTALLATION_DIR ]]; then
|
||||||
_p9k_installation_dir=${POWERLEVEL9K_INSTALLATION_DIR:A}
|
_p9k_installation_dir=${POWERLEVEL9K_INSTALLATION_DIR:A}
|
||||||
|
@ -40,12 +49,15 @@ else
|
||||||
else
|
else
|
||||||
>&2 print -P '%F{red}[ERROR]%f Powerlevel10k cannot figure out its installation directory.'
|
>&2 print -P '%F{red}[ERROR]%f Powerlevel10k cannot figure out its installation directory.'
|
||||||
>&2 print -P 'Please set %F{green}POWERLEVEL9K_INSTALLATION_DIR.%f'
|
>&2 print -P 'Please set %F{green}POWERLEVEL9K_INSTALLATION_DIR.%f'
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
_p9k_installation_dir=${${(%):-%x}:A:h}
|
_p9k_installation_dir=${${(%):-%x}:A:h}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -n $_p9k_installation_dir ]] && source $_p9k_installation_dir/internal/p10k.zsh
|
source $_p9k_installation_dir/internal/p10k.zsh
|
||||||
|
} always {
|
||||||
eval "$_p9k_aliases"
|
eval "$_p9k_aliases"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue