|
|
@ -98,7 +98,7 @@ function getColorCode() {
|
|
|
|
local v=${__p9k_colors[$k]}
|
|
|
|
local v=${__p9k_colors[$k]}
|
|
|
|
print -rP -- "%F{$v}$v - $k%f"
|
|
|
|
print -rP -- "%F{$v}$v - $k%f"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
background)
|
|
|
|
background)
|
|
|
|
local k
|
|
|
|
local k
|
|
|
@ -106,7 +106,7 @@ function getColorCode() {
|
|
|
|
local v=${__p9k_colors[$k]}
|
|
|
|
local v=${__p9k_colors[$k]}
|
|
|
|
print -rP -- "%K{$v}$v - $k%k"
|
|
|
|
print -rP -- "%K{$v}$v - $k%k"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -301,7 +301,7 @@ _p9k_cache_stat_get() {
|
|
|
|
local -a key=($0 $label fprint "$@" "$_p9k__cache_stat_fprint")
|
|
|
|
local -a key=($0 $label fprint "$@" "$_p9k__cache_stat_fprint")
|
|
|
|
_p9k__cache_fprint_key="${(pj:\0:)key}"
|
|
|
|
_p9k__cache_fprint_key="${(pj:\0:)key}"
|
|
|
|
shift 2 _p9k_cache_val
|
|
|
|
shift 2 _p9k_cache_val
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if (( $+commands[md5] )); then
|
|
|
|
if (( $+commands[md5] )); then
|
|
|
@ -325,7 +325,7 @@ _p9k_cache_stat_get() {
|
|
|
|
_p9k_cache_key=$meta_key
|
|
|
|
_p9k_cache_key=$meta_key
|
|
|
|
_p9k_cache_set "$_p9k__cache_stat_meta" "$_p9k__cache_stat_fprint" "$_p9k_cache_val[@]"
|
|
|
|
_p9k_cache_set "$_p9k__cache_stat_meta" "$_p9k__cache_stat_fprint" "$_p9k_cache_val[@]"
|
|
|
|
shift 2 _p9k_cache_val
|
|
|
|
shift 2 _p9k_cache_val
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
_p9k__cache_fprint_key=$_p9k_cache_key
|
|
|
|
_p9k__cache_fprint_key=$_p9k_cache_key
|
|
|
@ -1134,7 +1134,7 @@ prompt_battery() {
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
|
|
*)
|
|
|
|
*)
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
@ -1411,7 +1411,7 @@ prompt_dir() {
|
|
|
|
[[ -n $_p9k_cache_val[1] ]] || continue
|
|
|
|
[[ -n $_p9k_cache_val[1] ]] || continue
|
|
|
|
parts[1,i]=($_p9k_cache_val[1])
|
|
|
|
parts[1,i]=($_p9k_cache_val[1])
|
|
|
|
fake_first=1
|
|
|
|
fake_first=1
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -1844,7 +1844,7 @@ function _p9k_nvm_ls_default() {
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
system|v)
|
|
|
|
system|v)
|
|
|
|
_p9k_ret=system
|
|
|
|
_p9k_ret=system
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
iojs-[0-9]*)
|
|
|
|
iojs-[0-9]*)
|
|
|
|
v=iojs-v${v#iojs-}
|
|
|
|
v=iojs-v${v#iojs-}
|
|
|
@ -1857,10 +1857,10 @@ function _p9k_nvm_ls_default() {
|
|
|
|
if [[ $v == v*.*.* ]]; then
|
|
|
|
if [[ $v == v*.*.* ]]; then
|
|
|
|
if [[ -x $NVM_DIR/versions/node/$v/bin/node || -x $NVM_DIR/$v/bin/node ]]; then
|
|
|
|
if [[ -x $NVM_DIR/versions/node/$v/bin/node || -x $NVM_DIR/$v/bin/node ]]; then
|
|
|
|
_p9k_ret=$v
|
|
|
|
_p9k_ret=$v
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
elif [[ -x $NVM_DIR/versions/io.js/$v/bin/node ]]; then
|
|
|
|
elif [[ -x $NVM_DIR/versions/io.js/$v/bin/node ]]; then
|
|
|
|
_p9k_ret=iojs-$v
|
|
|
|
_p9k_ret=iojs-$v
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -1999,7 +1999,7 @@ prompt_dotnet_version() {
|
|
|
|
|
|
|
|
|
|
|
|
if (( _POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY )); then
|
|
|
|
if (( _POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY )); then
|
|
|
|
case $_p9k_pwd in
|
|
|
|
case $_p9k_pwd in
|
|
|
|
~|/) return;;
|
|
|
|
~|/) return 0;;
|
|
|
|
~/*)
|
|
|
|
~/*)
|
|
|
|
local parent=~/
|
|
|
|
local parent=~/
|
|
|
|
local parts=(${(s./.)_p9k_pwd#$parent})
|
|
|
|
local parts=(${(s./.)_p9k_pwd#$parent})
|
|
|
@ -2307,7 +2307,7 @@ prompt_swap() {
|
|
|
|
'M') (( used_bytes *= 1048576 ));;
|
|
|
|
'M') (( used_bytes *= 1048576 ));;
|
|
|
|
'G') (( used_bytes *= 1073741824 ));;
|
|
|
|
'G') (( used_bytes *= 1073741824 ));;
|
|
|
|
'T') (( used_bytes *= 1099511627776 ));;
|
|
|
|
'T') (( used_bytes *= 1099511627776 ));;
|
|
|
|
*) return;;
|
|
|
|
*) return 0;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
else
|
|
|
|
local meminfo && meminfo="$(grep -F 'Swap' /proc/meminfo 2>/dev/null)" || return
|
|
|
|
local meminfo && meminfo="$(grep -F 'Swap' /proc/meminfo 2>/dev/null)" || return
|
|
|
@ -3151,7 +3151,7 @@ prompt_kubecontext() {
|
|
|
|
for ((; pos > 0; --pos)); do
|
|
|
|
for ((; pos > 0; --pos)); do
|
|
|
|
local line=$cfg[pos]
|
|
|
|
local line=$cfg[pos]
|
|
|
|
if [[ $line == '- context:' ]]; then
|
|
|
|
if [[ $line == '- context:' ]]; then
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
elif [[ $line == (#b)' cluster: '([^\"\'\|\>]*) ]]; then
|
|
|
|
elif [[ $line == (#b)' cluster: '([^\"\'\|\>]*) ]]; then
|
|
|
|
cluster=$match[1]
|
|
|
|
cluster=$match[1]
|
|
|
|
elif [[ $line == (#b)' namespace: '([^\"\'\|\>]*) ]]; then
|
|
|
|
elif [[ $line == (#b)' namespace: '([^\"\'\|\>]*) ]]; then
|
|
|
@ -4220,9 +4220,12 @@ _p9k_precmd() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function _p9k_reset_prompt() {
|
|
|
|
function _p9k_reset_prompt() {
|
|
|
|
(( __p9k_ksh_arrays )) && setopt ksh_arrays
|
|
|
|
if zle; then
|
|
|
|
(( __p9k_sh_glob )) && setopt sh_glob
|
|
|
|
(( __p9k_ksh_arrays )) && setopt ksh_arrays
|
|
|
|
zle && zle .reset-prompt && zle -R
|
|
|
|
(( __p9k_sh_glob )) && setopt sh_glob
|
|
|
|
|
|
|
|
zle .reset-prompt
|
|
|
|
|
|
|
|
zle -R
|
|
|
|
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function _p9k_zle_keymap_select() {
|
|
|
|
function _p9k_zle_keymap_select() {
|
|
|
@ -4265,7 +4268,7 @@ function _p9k_on_async_message() {
|
|
|
|
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
|
|
|
|
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
|
|
|
|
if (( ARGC != 1 )); then
|
|
|
|
if (( ARGC != 1 )); then
|
|
|
|
_p9k_deinit_async_pump
|
|
|
|
_p9k_deinit_async_pump
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
local msg='' IFS=''
|
|
|
|
local msg='' IFS=''
|
|
|
|
while read -r -t -u $1 msg; do
|
|
|
|
while read -r -t -u $1 msg; do
|
|
|
@ -5179,7 +5182,7 @@ _p9k_init_ssh() {
|
|
|
|
typeset -gix P9K_SSH=0
|
|
|
|
typeset -gix P9K_SSH=0
|
|
|
|
if [[ -n $SSH_CLIENT || -n $SSH_TTY || -n $SSH_CONNECTION ]]; then
|
|
|
|
if [[ -n $SSH_CLIENT || -n $SSH_TTY || -n $SSH_CONNECTION ]]; then
|
|
|
|
P9K_SSH=1
|
|
|
|
P9K_SSH=1
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# When changing user on a remote system, the $SSH_CONNECTION environment variable can be lost.
|
|
|
|
# When changing user on a remote system, the $SSH_CONNECTION environment variable can be lost.
|
|
|
@ -5370,11 +5373,11 @@ _p9k_init_vcs() {
|
|
|
|
_p9k_vcs_info_init
|
|
|
|
_p9k_vcs_info_init
|
|
|
|
if (( $+functions[_p9k_preinit] )); then
|
|
|
|
if (( $+functions[_p9k_preinit] )); then
|
|
|
|
(( $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )) && gitstatus_start POWERLEVEL9K || _p9k__gitstatus_disabled=1
|
|
|
|
(( $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )) && gitstatus_start POWERLEVEL9K || _p9k__gitstatus_disabled=1
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if (( _POWERLEVEL9K_DISABLE_GITSTATUS )); then
|
|
|
|
if (( _POWERLEVEL9K_DISABLE_GITSTATUS )); then
|
|
|
|
_p9k__gitstatus_disabled=1
|
|
|
|
_p9k__gitstatus_disabled=1
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
(( $_POWERLEVEL9K_VCS_BACKENDS[(I)git] )) || return
|
|
|
|
(( $_POWERLEVEL9K_VCS_BACKENDS[(I)git] )) || return
|
|
|
|
|
|
|
|
|
|
|
@ -5411,7 +5414,7 @@ _p9k_init_vcs() {
|
|
|
|
>&2 echo -E - ""
|
|
|
|
>&2 echo -E - ""
|
|
|
|
>&2 echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
|
|
|
|
>&2 echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
|
|
|
|
>&2 echo -E - "${(%):- * Git prompt will be %Bfast%b.}"
|
|
|
|
>&2 echo -E - "${(%):- * Git prompt will be %Bfast%b.}"
|
|
|
|
return
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
local daemon=${GITSTATUS_DAEMON}
|
|
|
|
local daemon=${GITSTATUS_DAEMON}
|
|
|
@ -5702,7 +5705,7 @@ Example: Bind Ctrl+P to toggle right prompt.
|
|
|
|
typeset -gi __p9k_reset_state
|
|
|
|
typeset -gi __p9k_reset_state
|
|
|
|
|
|
|
|
|
|
|
|
function p10k() {
|
|
|
|
function p10k() {
|
|
|
|
[[ $# != 1 || $1 != finalize ]] || { p10k-instant-prompt-finalize; return }
|
|
|
|
[[ $# != 1 || $1 != finalize ]] || { p10k-instant-prompt-finalize; return 0 }
|
|
|
|
|
|
|
|
|
|
|
|
emulate -L zsh
|
|
|
|
emulate -L zsh
|
|
|
|
setopt no_hist_expand extended_glob prompt_percent prompt_subst no_aliases
|
|
|
|
setopt no_hist_expand extended_glob prompt_percent prompt_subst no_aliases
|
|
|
|