From 0378a0a54c74db5ef1d26ade098e48ed8d5af16d Mon Sep 17 00:00:00 2001 From: romkatv Date: Sun, 28 Jul 2019 12:19:51 +0200 Subject: [PATCH] cleanup --- internal/configure.zsh | 10 +++++----- internal/p10k.zsh | 4 ++-- internal/wizard.zsh | 8 ++++---- powerlevel9k.zsh-theme | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/configure.zsh b/internal/configure.zsh index 9da3153a..719b9f05 100644 --- a/internal/configure.zsh +++ b/internal/configure.zsh @@ -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_path=$__p9k_zd/$__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() { emulate -L zsh @@ -23,10 +23,10 @@ function _p9k_can_configure() { [[ ! -e $__p9k_cfg_path || -f $__p9k_cfg_path || -h $__p9k_cfg_path ]] || $0_error "$__p9k_cfg_path_u is a special file" - [[ -r $__p9k_installation_dir/config/p10k-lean.zsh ]] || - $0_error "cannot read $__p9k_installation_dir_u/config/p10k-lean.zsh" - [[ -r $__p9k_installation_dir/config/p10k-classic.zsh ]] || - $0_error "cannot read $__p9k_installation_dir_u/config/p10k-classic.zsh" + [[ -r $__p9k_root_dir/config/p10k-lean.zsh ]] || + $0_error "cannot read $__p9k_root_dir_u/config/p10k-lean.zsh" + [[ -r $__p9k_root_dir/config/p10k-classic.zsh ]] || + $0_error "cannot read $__p9k_root_dir_u/config/p10k-classic.zsh" } always { unfunction $0_error } diff --git a/internal/p10k.zsh b/internal/p10k.zsh index ec56de18..232cb078 100755 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -27,7 +27,7 @@ if ! autoload -Uz is-at-least || ! is-at-least 5.1; then return 1 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 # 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 _p9k_vcs_info_init 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 \ -s $_POWERLEVEL9K_VCS_STAGED_MAX_NUM \ -u $_POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM \ diff --git a/internal/wizard.zsh b/internal/wizard.zsh index 362b8393..83ec27b1 100755 --- a/internal/wizard.zsh +++ b/internal/wizard.zsh @@ -4,8 +4,8 @@ emulate -L zsh setopt extended_glob noaliases () { -typeset -gr __p9k_installation_dir=${1:-${0:h:h:A}} -source $__p9k_installation_dir/internal/configure.zsh || return +typeset -gr __p9k_root_dir=${1:-${0:h:h:A}} +source $__p9k_root_dir/internal/configure.zsh || return local POWERLEVEL9K_MODE cap_lock style config_backup local -i cap_diamond cap_python cap_narrow_icons num_lines config_overwrite @@ -286,7 +286,7 @@ function ask_config_overwrite() { } 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}") function sub() { lines=("${(@)lines/# typeset -g POWERLEVEL9K_$1=*/ typeset -g POWERLEVEL9K_$1=$2}") @@ -324,7 +324,7 @@ function generate_config() { } _p9k_can_configure || return -source $__p9k_installation_dir/internal/icons.zsh || return +source $__p9k_root_dir/internal/icons.zsh || return while true; do ask_diamond || { (( $? == 2 )) && continue || return } diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 6cedd415..95bce71b 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -25,28 +25,28 @@ fi return fi typeset -gr __p9k_sourced=1 - typeset -g __p9k_installation_dir='' + typeset -g __p9k_root_dir='' if [[ -n $POWERLEVEL9K_INSTALLATION_DIR ]]; then - __p9k_installation_dir=${POWERLEVEL9K_INSTALLATION_DIR:A} + __p9k_root_dir=${POWERLEVEL9K_INSTALLATION_DIR:A} else if [[ ${(%):-%N} == '(eval)' ]]; then if [[ $0 == '-antigen-load' && -r powerlevel9k.zsh-theme ]]; then # Antigen uses eval to load things so it can change the plugin (!!) # https://github.com/zsh-users/antigen/issues/581 - __p9k_installation_dir=$PWD + __p9k_root_dir=$PWD else >&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' return fi else - __p9k_installation_dir=${${(%):-%x}:A:h} + __p9k_root_dir=${${(%):-%x}:A:h} fi fi - typeset -gr __p9k_installation_dir - source $__p9k_installation_dir/internal/p10k.zsh || true + typeset -gr __p9k_root_dir + source $__p9k_root_dir/internal/p10k.zsh || true } (( ! __p9k_restore_aliases )) || setopt aliases