pull/145/head
romkatv 5 years ago
parent e28d0c37c9
commit 0378a0a54c

@ -3,7 +3,7 @@ typeset -gr __p9k_zd_u=${__p9k_zd/#(#b)$HOME(|\/*)/'~'$match[1]}
typeset -gr __p9k_cfg_basename=.p10k.zsh typeset -gr __p9k_cfg_basename=.p10k.zsh
typeset -gr __p9k_cfg_path=$__p9k_zd/$__p9k_cfg_basename typeset -gr __p9k_cfg_path=$__p9k_zd/$__p9k_cfg_basename
typeset -gr __p9k_cfg_path_u=$__p9k_zd_u/$__p9k_cfg_basename typeset -gr __p9k_cfg_path_u=$__p9k_zd_u/$__p9k_cfg_basename
typeset -gr __p9k_installation_dir_u=${__p9k_installation_dir/#(#b)$HOME(|\/*)/'~'$match[1]} typeset -gr __p9k_root_dir_u=${__p9k_root_dir/#(#b)$HOME(|\/*)/'~'$match[1]}
function _p9k_can_configure() { function _p9k_can_configure() {
emulate -L zsh emulate -L zsh
@ -23,10 +23,10 @@ function _p9k_can_configure() {
[[ ! -e $__p9k_cfg_path || -f $__p9k_cfg_path || -h $__p9k_cfg_path ]] || [[ ! -e $__p9k_cfg_path || -f $__p9k_cfg_path || -h $__p9k_cfg_path ]] ||
$0_error "$__p9k_cfg_path_u is a special file" $0_error "$__p9k_cfg_path_u is a special file"
[[ -r $__p9k_installation_dir/config/p10k-lean.zsh ]] || [[ -r $__p9k_root_dir/config/p10k-lean.zsh ]] ||
$0_error "cannot read $__p9k_installation_dir_u/config/p10k-lean.zsh" $0_error "cannot read $__p9k_root_dir_u/config/p10k-lean.zsh"
[[ -r $__p9k_installation_dir/config/p10k-classic.zsh ]] || [[ -r $__p9k_root_dir/config/p10k-classic.zsh ]] ||
$0_error "cannot read $__p9k_installation_dir_u/config/p10k-classic.zsh" $0_error "cannot read $__p9k_root_dir_u/config/p10k-classic.zsh"
} always { } always {
unfunction $0_error unfunction $0_error
} }

@ -27,7 +27,7 @@ if ! autoload -Uz is-at-least || ! is-at-least 5.1; then
return 1 return 1
fi fi
source "${__p9k_installation_dir}/internal/icons.zsh" source "${__p9k_root_dir}/internal/icons.zsh"
# For compatibility with Powerlevel9k. It's not recommended to use mnemonic color # For compatibility with Powerlevel9k. It's not recommended to use mnemonic color
# names in the configuration except for colors 0-7 as these are standard. # names in the configuration except for colors 0-7 as these are standard.
@ -4126,7 +4126,7 @@ _p9k_init() {
if _p9k_segment_in_use vcs; then if _p9k_segment_in_use vcs; then
_p9k_vcs_info_init _p9k_vcs_info_init
if [[ $_POWERLEVEL9K_DISABLE_GITSTATUS == 0 && -n $_POWERLEVEL9K_VCS_BACKENDS[(r)git] ]]; then if [[ $_POWERLEVEL9K_DISABLE_GITSTATUS == 0 && -n $_POWERLEVEL9K_VCS_BACKENDS[(r)git] ]]; then
source ${_POWERLEVEL9K_GITSTATUS_DIR:-${__p9k_installation_dir}/gitstatus}/gitstatus.plugin.zsh source ${_POWERLEVEL9K_GITSTATUS_DIR:-${__p9k_root_dir}/gitstatus}/gitstatus.plugin.zsh
gitstatus_start \ gitstatus_start \
-s $_POWERLEVEL9K_VCS_STAGED_MAX_NUM \ -s $_POWERLEVEL9K_VCS_STAGED_MAX_NUM \
-u $_POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM \ -u $_POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM \

@ -4,8 +4,8 @@ emulate -L zsh
setopt extended_glob noaliases setopt extended_glob noaliases
() { () {
typeset -gr __p9k_installation_dir=${1:-${0:h:h:A}} typeset -gr __p9k_root_dir=${1:-${0:h:h:A}}
source $__p9k_installation_dir/internal/configure.zsh || return source $__p9k_root_dir/internal/configure.zsh || return
local POWERLEVEL9K_MODE cap_lock style config_backup local POWERLEVEL9K_MODE cap_lock style config_backup
local -i cap_diamond cap_python cap_narrow_icons num_lines config_overwrite local -i cap_diamond cap_python cap_narrow_icons num_lines config_overwrite
@ -286,7 +286,7 @@ function ask_config_overwrite() {
} }
function generate_config() { function generate_config() {
local base && base="$(<$__p9k_installation_dir/config/p10k-$style.zsh)" || return local base && base="$(<$__p9k_root_dir/config/p10k-$style.zsh)" || return
local lines=("${(@f)base}") local lines=("${(@f)base}")
function sub() { function sub() {
lines=("${(@)lines/# typeset -g POWERLEVEL9K_$1=*/ typeset -g POWERLEVEL9K_$1=$2}") lines=("${(@)lines/# typeset -g POWERLEVEL9K_$1=*/ typeset -g POWERLEVEL9K_$1=$2}")
@ -324,7 +324,7 @@ function generate_config() {
} }
_p9k_can_configure || return _p9k_can_configure || return
source $__p9k_installation_dir/internal/icons.zsh || return source $__p9k_root_dir/internal/icons.zsh || return
while true; do while true; do
ask_diamond || { (( $? == 2 )) && continue || return } ask_diamond || { (( $? == 2 )) && continue || return }

@ -25,28 +25,28 @@ fi
return return
fi fi
typeset -gr __p9k_sourced=1 typeset -gr __p9k_sourced=1
typeset -g __p9k_installation_dir='' typeset -g __p9k_root_dir=''
if [[ -n $POWERLEVEL9K_INSTALLATION_DIR ]]; then if [[ -n $POWERLEVEL9K_INSTALLATION_DIR ]]; then
__p9k_installation_dir=${POWERLEVEL9K_INSTALLATION_DIR:A} __p9k_root_dir=${POWERLEVEL9K_INSTALLATION_DIR:A}
else else
if [[ ${(%):-%N} == '(eval)' ]]; then if [[ ${(%):-%N} == '(eval)' ]]; then
if [[ $0 == '-antigen-load' && -r powerlevel9k.zsh-theme ]]; then if [[ $0 == '-antigen-load' && -r powerlevel9k.zsh-theme ]]; then
# Antigen uses eval to load things so it can change the plugin (!!) # Antigen uses eval to load things so it can change the plugin (!!)
# https://github.com/zsh-users/antigen/issues/581 # https://github.com/zsh-users/antigen/issues/581
__p9k_installation_dir=$PWD __p9k_root_dir=$PWD
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 return
fi fi
else else
__p9k_installation_dir=${${(%):-%x}:A:h} __p9k_root_dir=${${(%):-%x}:A:h}
fi fi
fi fi
typeset -gr __p9k_installation_dir typeset -gr __p9k_root_dir
source $__p9k_installation_dir/internal/p10k.zsh || true source $__p9k_root_dir/internal/p10k.zsh || true
} }
(( ! __p9k_restore_aliases )) || setopt aliases (( ! __p9k_restore_aliases )) || setopt aliases

Loading…
Cancel
Save