mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
replace all -v checks with equivalents (trying to port to zsh 5.2)
This commit is contained in:
parent
6ef8e2f0cf
commit
361eec6f95
3 changed files with 8 additions and 8 deletions
|
@ -550,8 +550,8 @@ function _p9k_init_icons() {
|
||||||
function print_icon() {
|
function print_icon() {
|
||||||
local icon_name=$1
|
local icon_name=$1
|
||||||
local var_name=POWERLEVEL9K_${icon_name}
|
local var_name=POWERLEVEL9K_${icon_name}
|
||||||
if [[ -v "$var_name" ]]; then
|
if [[ -n "${(tP)var_name}" ]]; then
|
||||||
echo -n "${(P)ICON_USER_VARIABLE}"
|
echo -n "${(P)var_name}"
|
||||||
else
|
else
|
||||||
echo -n "${icons[$icon_name]}"
|
echo -n "${icons[$icon_name]}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -22,7 +22,7 @@ function set_default() {
|
||||||
|
|
||||||
local varname=$1
|
local varname=$1
|
||||||
shift
|
shift
|
||||||
if [[ -v $varname ]]; then
|
if [[ -n ${(tP)varname} ]]; then
|
||||||
typeset $flags $varname
|
typeset $flags $varname
|
||||||
elif [[ "$flags" == *[aA]* ]]; then
|
elif [[ "$flags" == *[aA]* ]]; then
|
||||||
eval "typeset ${(@q)flags} ${(q)varname}=(${(qq)@})"
|
eval "typeset ${(@q)flags} ${(q)varname}=(${(qq)@})"
|
||||||
|
|
|
@ -55,7 +55,7 @@ if ! autoload -U is-at-least || ! is-at-least 5.2; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -v _P9K_SOURCED ]]; then
|
if (( $+_P9K_SOURCED )); then
|
||||||
prompt_powerlevel9k_setup "$@"
|
prompt_powerlevel9k_setup "$@"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -1608,7 +1608,7 @@ powerlevel9k_vcs_init() {
|
||||||
local component state
|
local component state
|
||||||
for component in REMOTE_URL COMMIT BRANCH TAG REMOTE_BRANCH STAGED UNSTAGED UNTRACKED \
|
for component in REMOTE_URL COMMIT BRANCH TAG REMOTE_BRANCH STAGED UNSTAGED UNTRACKED \
|
||||||
OUTGOING_CHANGES INCOMING_CHANGES STASH ACTION; do
|
OUTGOING_CHANGES INCOMING_CHANGES STASH ACTION; do
|
||||||
local color=${(P):-POWERLEVEL9K_VCS_${component}FORMAT_FOREGROUND}
|
local color=${(P)${:-POWERLEVEL9K_VCS_${component}FORMAT_FOREGROUND}}
|
||||||
if [[ -n $color ]]; then
|
if [[ -n $color ]]; then
|
||||||
for state in "${(@k)vcs_states}"; do
|
for state in "${(@k)vcs_states}"; do
|
||||||
local var=POWERLEVEL9K_VCS_${(U)state}_${component}FORMAT_FOREGROUND
|
local var=POWERLEVEL9K_VCS_${(U)state}_${component}FORMAT_FOREGROUND
|
||||||
|
@ -1661,7 +1661,7 @@ typeset -gAH _P9K_LAST_GIT_PROMPT
|
||||||
typeset -gAH _P9K_GIT_SLOW
|
typeset -gAH _P9K_GIT_SLOW
|
||||||
|
|
||||||
function _p9k_vcs_style() {
|
function _p9k_vcs_style() {
|
||||||
local color=${(P):-POWERLEVEL9K_VCS_${1}_${2}FORMAT_FOREGROUND}
|
local color=${(P)${:-POWERLEVEL9K_VCS_${1}_${2}FORMAT_FOREGROUND}}
|
||||||
if [[ -z $color ]]; then
|
if [[ -z $color ]]; then
|
||||||
_P9K_RETVAL=""
|
_P9K_RETVAL=""
|
||||||
return
|
return
|
||||||
|
@ -1679,7 +1679,7 @@ function _p9k_vcs_style() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _p9k_vcs_render() {
|
function _p9k_vcs_render() {
|
||||||
if [[ -v _P9K_NEXT_VCS_DIR ]]; then
|
if (( $+_P9K_NEXT_VCS_DIR )); then
|
||||||
local -a msg
|
local -a msg
|
||||||
local dir=${${GIT_DIR:a}:-$PWD}
|
local dir=${${GIT_DIR:a}:-$PWD}
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -1864,7 +1864,7 @@ function _p9k_vcs_resume() {
|
||||||
function _p9k_vcs_gitstatus() {
|
function _p9k_vcs_gitstatus() {
|
||||||
[[ $POWERLEVEL9K_DISABLE_GITSTATUS == true ]] && return 1
|
[[ $POWERLEVEL9K_DISABLE_GITSTATUS == true ]] && return 1
|
||||||
if [[ $_P9K_REFRESH_REASON == precmd ]]; then
|
if [[ $_P9K_REFRESH_REASON == precmd ]]; then
|
||||||
if [[ -v _P9K_NEXT_VCS_DIR ]]; then
|
if (( $+_P9K_NEXT_VCS_DIR )); then
|
||||||
typeset -gH _P9K_NEXT_VCS_DIR=${${GIT_DIR:a}:-$PWD}
|
typeset -gH _P9K_NEXT_VCS_DIR=${${GIT_DIR:a}:-$PWD}
|
||||||
else
|
else
|
||||||
local dir=${${GIT_DIR:a}:-$PWD}
|
local dir=${${GIT_DIR:a}:-$PWD}
|
||||||
|
|
Loading…
Reference in a new issue