1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-12 08:10:07 +00:00

return => return 0

This commit is contained in:
romkatv 2019-11-04 09:07:06 +01:00
parent e3a2716afa
commit d0ff9df8d0
3 changed files with 39 additions and 36 deletions

View file

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

View file

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

View file

@ -24,7 +24,7 @@
setopt no_hist_expand extended_glob no_prompt_bang no_prompt_subst prompt_percent no_aliases
if (( $+__p9k_sourced )); then
prompt_powerlevel9k_setup
return
return 0
fi
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