return => return 0

pull/328/head
romkatv 5 years ago
parent e3a2716afa
commit d0ff9df8d0

@ -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() {
if zle; then
(( __p9k_ksh_arrays )) && setopt ksh_arrays (( __p9k_ksh_arrays )) && setopt ksh_arrays
(( __p9k_sh_glob )) && setopt sh_glob (( __p9k_sh_glob )) && setopt sh_glob
zle && zle .reset-prompt && zle -R 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

@ -264,7 +264,7 @@ function can_install_font() {
[[ -w ~ ]] || return [[ -w ~ ]] || return
fi fi
terminal=Termux terminal=Termux
return return 0
fi fi
if [[ "$(uname)" == Darwin && $TERM_PROGRAM == iTerm.app ]]; then if [[ "$(uname)" == Darwin && $TERM_PROGRAM == iTerm.app ]]; then
(( $+commands[curl] )) || return (( $+commands[curl] )) || return
@ -288,7 +288,7 @@ function can_install_font() {
[[ $font == (#b)*' '(<->) ]] || return [[ $font == (#b)*' '(<->) ]] || return
iterm2_font_size=$match[1] iterm2_font_size=$match[1]
terminal=iTerm2 terminal=iTerm2
return return 0
fi fi
return 1 return 1
} }
@ -503,7 +503,7 @@ function ask_debian() {
function ask_narrow_icons() { function ask_narrow_icons() {
if [[ $POWERLEVEL9K_MODE == (powerline|compatible) ]]; then if [[ $POWERLEVEL9K_MODE == (powerline|compatible) ]]; then
cap_narrow_icons=0 cap_narrow_icons=0
return return 0
fi fi
local text="X" local text="X"
text+="%1F${icons[VCS_GIT_ICON]// }%fX" text+="%1F${icons[VCS_GIT_ICON]// }%fX"
@ -675,7 +675,7 @@ function ask_frame_color() {
function ask_time() { function ask_time() {
if (( wizard_columns < 80 )); then if (( wizard_columns < 80 )); then
show_time= show_time=
return return 0
fi fi
while true; do while true; do
@ -751,7 +751,7 @@ function os_icon_name() {
function ask_extra_icons() { function ask_extra_icons() {
if [[ $POWERLEVEL9K_MODE == (powerline|compatible) ]]; then if [[ $POWERLEVEL9K_MODE == (powerline|compatible) ]]; then
return return 0
fi fi
local os_icon=${(g::)icons[$(os_icon_name)]} local os_icon=${(g::)icons[$(os_icon_name)]}
local dir_icon=${(g::)icons[HOME_SUB_ICON]} local dir_icon=${(g::)icons[HOME_SUB_ICON]}
@ -808,7 +808,7 @@ function ask_prefixes() {
if (( wizard_columns < 80 )); then if (( wizard_columns < 80 )); then
prefixes=("$concise[@]") prefixes=("$concise[@]")
options+=concise options+=concise
return return 0
fi fi
while true; do while true; do
clear clear
@ -839,7 +839,7 @@ function ask_prefixes() {
function ask_separators() { function ask_separators() {
if [[ $style != (classic|rainbow) || $cap_diamond != 1 ]]; then if [[ $style != (classic|rainbow) || $cap_diamond != 1 ]]; then
return return 0
fi fi
if [[ $POWERLEVEL9K_MODE == nerdfont-complete && $LINES -lt 26 ]]; then if [[ $POWERLEVEL9K_MODE == nerdfont-complete && $LINES -lt 26 ]]; then
local nl='' local nl=''
@ -926,7 +926,7 @@ function ask_separators() {
function ask_heads() { function ask_heads() {
if [[ $style != (classic|rainbow) || $cap_diamond != 1 ]]; then if [[ $style != (classic|rainbow) || $cap_diamond != 1 ]]; then
return return 0
fi fi
if [[ $POWERLEVEL9K_MODE == nerdfont-complete && $LINES -lt 26 ]]; then if [[ $POWERLEVEL9K_MODE == nerdfont-complete && $LINES -lt 26 ]]; then
local nl='' local nl=''
@ -995,7 +995,7 @@ function ask_heads() {
function ask_tails() { function ask_tails() {
if [[ $style != (classic|rainbow) ]]; then if [[ $style != (classic|rainbow) ]]; then
return return 0
fi fi
if [[ $POWERLEVEL9K_MODE == nerdfont-complete && $LINES -lt 31 ]]; then if [[ $POWERLEVEL9K_MODE == nerdfont-complete && $LINES -lt 31 ]]; then
local nl='' local nl=''
@ -1105,7 +1105,7 @@ function ask_num_lines() {
function ask_gap_char() { function ask_gap_char() {
if [[ $num_lines != 2 ]]; then if [[ $num_lines != 2 ]]; then
return return 0
fi fi
while true; do while true; do
clear clear
@ -1141,7 +1141,7 @@ function ask_gap_char() {
function ask_frame() { function ask_frame() {
if [[ $style != (classic|rainbow) || $num_lines != 2 ]]; then if [[ $style != (classic|rainbow) || $num_lines != 2 ]]; then
return return 0
fi fi
(( LINES >= 26 )) && local nl=$'\n' || local nl='' (( LINES >= 26 )) && local nl=$'\n' || local nl=''
@ -1217,7 +1217,7 @@ function ask_instant_prompt() {
autoload -Uz is-at-least autoload -Uz is-at-least
if ! is-at-least 5.4; then if ! is-at-least 5.4; then
instant_prompt=off instant_prompt=off
return return 0
fi fi
if (( LINES < 24 )); then if (( LINES < 24 )); then
local nl='' local nl=''
@ -1286,7 +1286,7 @@ function ask_config_overwrite() {
config_backup= config_backup=
config_backup_u=0 config_backup_u=0
if [[ ! -e $__p9k_cfg_path ]]; then if [[ ! -e $__p9k_cfg_path ]]; then
return return 0
fi fi
while true; do while true; do
clear clear
@ -1381,7 +1381,7 @@ function generate_config() {
unlink $__p9k_cfg_path || return unlink $__p9k_cfg_path || return
fi fi
cp $__p9k_root_dir/config/p10k-$style.zsh $__p9k_cfg_path || return cp $__p9k_root_dir/config/p10k-$style.zsh $__p9k_cfg_path || return
return return 0
fi fi
local base && base="$(<$__p9k_root_dir/config/p10k-$style.zsh)" || return local base && base="$(<$__p9k_root_dir/config/p10k-$style.zsh)" || return

@ -24,7 +24,7 @@
setopt no_hist_expand extended_glob no_prompt_bang no_prompt_subst prompt_percent no_aliases setopt no_hist_expand extended_glob no_prompt_bang no_prompt_subst prompt_percent no_aliases
if (( $+__p9k_sourced )); then if (( $+__p9k_sourced )); then
prompt_powerlevel9k_setup prompt_powerlevel9k_setup
return return 0
fi fi
typeset -gr __p9k_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh typeset -gr __p9k_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then

Loading…
Cancel
Save