|
|
@ -2239,7 +2239,7 @@ prompt_prompt_char() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
instant_prompt_prompt_char() {
|
|
|
|
instant_prompt_prompt_char() {
|
|
|
|
_p9k_prompt_segment prompt_char_OK_VIINS "$_p9k_color1" 76 '' 0 '' '❯'
|
|
|
|
_p9k_prompt_segment prompt_prompt_char_OK_VIINS "$_p9k_color1" 76 '' 0 '' '❯'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
################################################################
|
|
|
|
################################################################
|
|
|
@ -3474,8 +3474,9 @@ _p9k_set_instant_prompt() {
|
|
|
|
RPROMPT=$saved_rprompt
|
|
|
|
RPROMPT=$saved_rprompt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typeset -gri __p9k_instant_prompt_version=1
|
|
|
|
|
|
|
|
|
|
|
|
_p9k_dump_instant_prompt() {
|
|
|
|
_p9k_dump_instant_prompt() {
|
|
|
|
is-at-least 5.4 || return # `typeset -g` doesn't roundtrip in zsh prior to 5.4.
|
|
|
|
|
|
|
|
local user=${(%):-%n}
|
|
|
|
local user=${(%):-%n}
|
|
|
|
local root_dir=${__p9k_dump_file:h}
|
|
|
|
local root_dir=${__p9k_dump_file:h}
|
|
|
|
local prompt_dir=${root_dir}/p10k-$user
|
|
|
|
local prompt_dir=${root_dir}/p10k-$user
|
|
|
@ -3484,7 +3485,8 @@ _p9k_dump_instant_prompt() {
|
|
|
|
[[ -d $prompt_dir ]] || mkdir -p $prompt_dir || return
|
|
|
|
[[ -d $prompt_dir ]] || mkdir -p $prompt_dir || return
|
|
|
|
[[ -w $root_dir && -w $prompt_dir ]] || return
|
|
|
|
[[ -w $root_dir && -w $prompt_dir ]] || return
|
|
|
|
|
|
|
|
|
|
|
|
if [[ ! -e $root_file ]]; then
|
|
|
|
if [[ ! -e $root_file ||
|
|
|
|
|
|
|
|
($+__p9k_instant_prompt_sourced == 1 && $__p9k_instant_prompt_sourced != $__p9k_instant_prompt_version) ]]; then
|
|
|
|
local tmp=$root_file.tmp.$$
|
|
|
|
local tmp=$root_file.tmp.$$
|
|
|
|
local -i fd
|
|
|
|
local -i fd
|
|
|
|
sysopen -a -o creat,trunc -u fd $tmp || return
|
|
|
|
sysopen -a -o creat,trunc -u fd $tmp || return
|
|
|
@ -3492,7 +3494,7 @@ _p9k_dump_instant_prompt() {
|
|
|
|
>&$fd print -r -- "() {
|
|
|
|
>&$fd print -r -- "() {
|
|
|
|
emulate -L zsh
|
|
|
|
emulate -L zsh
|
|
|
|
(( ! \$+__p9k_instant_prompt_disabled )) || return
|
|
|
|
(( ! \$+__p9k_instant_prompt_disabled )) || return
|
|
|
|
typeset -gi __p9k_instant_prompt_disabled=1 __p9k_instant_prompt_sourced=1
|
|
|
|
typeset -gi __p9k_instant_prompt_disabled=1 __p9k_instant_prompt_sourced=$__p9k_instant_prompt_version
|
|
|
|
[[ -t 0 && -t 1 && -t 2 && \$ZSH_VERSION == ${(q)ZSH_VERSION} && \$ZSH_PATCHLEVEL == ${(q)ZSH_PATCHLEVEL} ]] || return
|
|
|
|
[[ -t 0 && -t 1 && -t 2 && \$ZSH_VERSION == ${(q)ZSH_VERSION} && \$ZSH_PATCHLEVEL == ${(q)ZSH_PATCHLEVEL} ]] || return
|
|
|
|
local -i ZLE_RPROMPT_INDENT=${ZLE_RPROMPT_INDENT:-1}
|
|
|
|
local -i ZLE_RPROMPT_INDENT=${ZLE_RPROMPT_INDENT:-1}
|
|
|
|
local PROMPT_EOL_MARK=${(q)PROMPT_EOL_MARK-%B%S%#%s%b}
|
|
|
|
local PROMPT_EOL_MARK=${(q)PROMPT_EOL_MARK-%B%S%#%s%b}
|
|
|
@ -3515,8 +3517,13 @@ _p9k_dump_instant_prompt() {
|
|
|
|
{ content="$(<$prompt_file)" } 2>/dev/null || return
|
|
|
|
{ content="$(<$prompt_file)" } 2>/dev/null || return
|
|
|
|
local tail=${content##*$rs$key$us}
|
|
|
|
local tail=${content##*$rs$key$us}
|
|
|
|
[[ ${#tail} != ${#content} ]] || return
|
|
|
|
[[ ${#tail} != ${#content} ]] || return
|
|
|
|
local -a _p9k_t=("${(@ps:$us:)${tail%%$rs*}}")
|
|
|
|
local -a _p9k_t=("${(@ps:$us:)${tail%%$rs*}}")'
|
|
|
|
typeset -ga __p9k_used_instant_prompt=("${(@e)_p9k_t[-3,-1]}")
|
|
|
|
(( __p9k_ksh_arrays )) && >&$fd print -r -- ' setopt ksh_arrays'
|
|
|
|
|
|
|
|
(( __p9k_sh_glob )) && >&$fd print -r -- ' setopt sh_glob'
|
|
|
|
|
|
|
|
>&$fd print -r -- ' typeset -ga __p9k_used_instant_prompt=("${(@e)_p9k_t[-3,-1]}")'
|
|
|
|
|
|
|
|
(( __p9k_ksh_arrays )) && >&$fd print -r -- ' unsetopt ksh_arrays'
|
|
|
|
|
|
|
|
(( __p9k_sh_glob )) && >&$fd print -r -- ' unsetopt sh_glob'
|
|
|
|
|
|
|
|
>&$fd print -r -- '
|
|
|
|
local _p9k_ret=
|
|
|
|
local _p9k_ret=
|
|
|
|
function _p9k_prompt_length() {
|
|
|
|
function _p9k_prompt_length() {
|
|
|
|
local COLUMNS=1024
|
|
|
|
local COLUMNS=1024
|
|
|
@ -3567,6 +3574,7 @@ _p9k_dump_instant_prompt() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
zmodload -F zsh/files b:zf_rm
|
|
|
|
zmodload -F zsh/files b:zf_rm
|
|
|
|
zf_rm -f -- ${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh{,.zwc} 2>/dev/null
|
|
|
|
zf_rm -f -- ${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh{,.zwc} 2>/dev/null
|
|
|
|
|
|
|
|
setopt prompt_cr prompt_sp
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
zmodload zsh/sched
|
|
|
|
zmodload zsh/sched
|
|
|
@ -3574,7 +3582,11 @@ _p9k_dump_instant_prompt() {
|
|
|
|
precmd_functions=(${(@)precmd_functions:#_p9k_instant_prompt_precmd_first})
|
|
|
|
precmd_functions=(${(@)precmd_functions:#_p9k_instant_prompt_precmd_first})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
precmd_functions=(_p9k_instant_prompt_precmd_first $precmd_functions)
|
|
|
|
precmd_functions=(_p9k_instant_prompt_precmd_first $precmd_functions)
|
|
|
|
} && unsetopt prompt_cr prompt_sp'
|
|
|
|
typeset -g __p9k_instant_prompt_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
|
|
|
|
|
|
|
|
if source $__p9k_instant_prompt_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
|
|
|
|
|
|
|
|
_p9k_preinit
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
} || true'
|
|
|
|
} always {
|
|
|
|
} always {
|
|
|
|
exec {fd}>&-
|
|
|
|
exec {fd}>&-
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -3660,7 +3672,6 @@ _p9k_save_status() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function _p9k_dump_state() {
|
|
|
|
function _p9k_dump_state() {
|
|
|
|
is-at-least 5.4 || return # `typeset -g` doesn't roundtrip in zsh prior to 5.4.
|
|
|
|
|
|
|
|
local dir=${__p9k_dump_file:h}
|
|
|
|
local dir=${__p9k_dump_file:h}
|
|
|
|
[[ -d $dir ]] || mkdir -p $dir || return
|
|
|
|
[[ -d $dir ]] || mkdir -p $dir || return
|
|
|
|
[[ -w $dir ]] || return
|
|
|
|
[[ -w $dir ]] || return
|
|
|
@ -3669,7 +3680,7 @@ function _p9k_dump_state() {
|
|
|
|
sysopen -a -m 600 -o creat,trunc -u fd $tmp || return
|
|
|
|
sysopen -a -m 600 -o creat,trunc -u fd $tmp || return
|
|
|
|
{
|
|
|
|
{
|
|
|
|
local include='_POWERLEVEL9K_*|_p9k_*|icons|OS|DEFAULT_COLOR|DEFAULT_COLOR_INVERTED'
|
|
|
|
local include='_POWERLEVEL9K_*|_p9k_*|icons|OS|DEFAULT_COLOR|DEFAULT_COLOR_INVERTED'
|
|
|
|
local exclude='_p9k_gitstatus_*|_p9k_cache_stat_meta|_p9k_cache_stat_fprint|_p9k_cache_fprint_key|_p9k_param_sig|_p9k_public_ip|_p9k_prompt|_p9k_prompt_idx|_p9k_dump_pid|_p9k_state_dump_scheduled|_p9k_line_finished|_p9k_preexec_cmd|_p9k_status|_p9k_pipestatus|_p9k_timer_start|_p9k_region_active|_p9k_keymap|_p9k_zle_state|_p9k_async_pump_*|_p9k_cache_ephemeral'
|
|
|
|
local exclude='_p9k_instant_prompt_sig|_p9k_gitstatus_*|_p9k_cache_stat_meta|_p9k_cache_stat_fprint|_p9k_cache_fprint_key|_p9k_param_sig|_p9k_public_ip|_p9k_prompt|_p9k_prompt_idx|_p9k_dump_pid|_p9k_state_dump_scheduled|_p9k_line_finished|_p9k_preexec_cmd|_p9k_status|_p9k_pipestatus|_p9k_timer_start|_p9k_region_active|_p9k_keymap|_p9k_zle_state|_p9k_async_pump_*|_p9k_cache_ephemeral'
|
|
|
|
typeset -g __p9k_cached_param_sig=$_p9k_param_sig
|
|
|
|
typeset -g __p9k_cached_param_sig=$_p9k_param_sig
|
|
|
|
typeset -p __p9k_cached_param_sig >&$fd || return
|
|
|
|
typeset -p __p9k_cached_param_sig >&$fd || return
|
|
|
|
unset __p9k_cached_param_sig
|
|
|
|
unset __p9k_cached_param_sig
|
|
|
@ -3784,20 +3795,24 @@ _p9k_precmd_impl() {
|
|
|
|
PROMPT='${$((_p9k_clear_instant_prompt()))+}'$PROMPT
|
|
|
|
PROMPT='${$((_p9k_clear_instant_prompt()))+}'$PROMPT
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
_p9k_instant_prompt_sig=$_p9k_pwd:$P9K_SSH:${(%):-%#}
|
|
|
|
(( __p9k_dumps_enabled )) || return 0
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: use _POWERLEVEL9K_DISABLE_INSTANT_PROMPT.
|
|
|
|
_p9k_instant_prompt_sig=$_p9k_pwd:$P9K_SSH:${(%):-%#}
|
|
|
|
|
|
|
|
|
|
|
|
if (( ! _p9k_dump_pid )) || ! kill -0 $_p9k_dump_pid 2>/dev/null; then
|
|
|
|
if (( ! _p9k_dump_pid )) || ! kill -0 $_p9k_dump_pid 2>/dev/null; then
|
|
|
|
_p9k_dump_pid=0
|
|
|
|
_p9k_dump_pid=0
|
|
|
|
if (( _p9k_prompt_idx == 1 )) then
|
|
|
|
if (( _p9k_prompt_idx == 1 )) then
|
|
|
|
_p9k_set_instant_prompt
|
|
|
|
(( _POWERLEVEL9K_DISABLE_INSTANT_PROMPT )) || _p9k_set_instant_prompt
|
|
|
|
if (( !_p9k_state_restored )); then
|
|
|
|
if (( !_p9k_state_restored )); then
|
|
|
|
|
|
|
|
if (( !_POWERLEVEL9K_DISABLE_INSTANT_PROMPT )); then
|
|
|
|
_p9k_dump_instant_prompt
|
|
|
|
_p9k_dump_instant_prompt
|
|
|
|
|
|
|
|
_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig]=1
|
|
|
|
|
|
|
|
fi
|
|
|
|
_p9k_dump_state
|
|
|
|
_p9k_dump_state
|
|
|
|
_p9k_state_dump_scheduled=0
|
|
|
|
_p9k_state_dump_scheduled=0
|
|
|
|
_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig]=1
|
|
|
|
elif [[ $_POWERLEVEL9K_DISABLE_INSTANT_PROMPT == 0 &&
|
|
|
|
elif [[ "${(pj:\x1f:)__p9k_used_instant_prompt}" != "${(e)_p9k_instant_prompt}" ]]; then
|
|
|
|
( $+__p9k_instant_prompt_sourced == 1 && $__p9k_instant_prompt_sourced != $__p9k_instant_prompt_version ||
|
|
|
|
|
|
|
|
"${(pj:\x1f:)__p9k_used_instant_prompt}" != "${(e)_p9k_instant_prompt}" ) ]]; then
|
|
|
|
_p9k_dump_instant_prompt
|
|
|
|
_p9k_dump_instant_prompt
|
|
|
|
if (( ! $+_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig] )); then
|
|
|
|
if (( ! $+_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig] )); then
|
|
|
|
_p9k_dump_state
|
|
|
|
_p9k_dump_state
|
|
|
@ -3805,9 +3820,9 @@ _p9k_precmd_impl() {
|
|
|
|
_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig]=1
|
|
|
|
_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig]=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
elif (( _p9k_state_dump_scheduled || ! $+_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig] )); then
|
|
|
|
elif (( _p9k_state_dump_scheduled || ! (_POWERLEVEL9K_DISABLE_INSTANT_PROMPT || $+_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig]) )); then
|
|
|
|
(
|
|
|
|
(
|
|
|
|
if (( ! $+_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig] )); then
|
|
|
|
if ! (( _POWERLEVEL9K_DISABLE_INSTANT_PROMPT || $+_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig] )); then
|
|
|
|
_p9k_set_instant_prompt
|
|
|
|
_p9k_set_instant_prompt
|
|
|
|
_p9k_dump_instant_prompt
|
|
|
|
_p9k_dump_instant_prompt
|
|
|
|
_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig]=1
|
|
|
|
_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig]=1
|
|
|
@ -3816,7 +3831,7 @@ _p9k_precmd_impl() {
|
|
|
|
) &!
|
|
|
|
) &!
|
|
|
|
_p9k_dump_pid=$!
|
|
|
|
_p9k_dump_pid=$!
|
|
|
|
_p9k_state_dump_scheduled=0
|
|
|
|
_p9k_state_dump_scheduled=0
|
|
|
|
_p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig]=1
|
|
|
|
(( _POWERLEVEL9K_DISABLE_INSTANT_PROMPT )) || _p9k_dumped_instant_prompt_sigs[$_p9k_instant_prompt_sig]=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4691,9 +4706,9 @@ _p9k_init_prompt() {
|
|
|
|
_p9k_reset_on_line_finish=$((!$?))
|
|
|
|
_p9k_reset_on_line_finish=$((!$?))
|
|
|
|
|
|
|
|
|
|
|
|
_p9k_t+=$_p9k_gap_pre
|
|
|
|
_p9k_t+=$_p9k_gap_pre
|
|
|
|
_p9k_gap_pre='${(e)_p9k_t['$#_p9k_t']}'
|
|
|
|
_p9k_gap_pre='${(e)_p9k_t['$(($#_p9k_t - __p9k_ksh_arrays))']}'
|
|
|
|
_p9k_t+=$_p9k_prompt_prefix_left
|
|
|
|
_p9k_t+=$_p9k_prompt_prefix_left
|
|
|
|
_p9k_prompt_prefix_left='${(e)_p9k_t['$#_p9k_t']}'
|
|
|
|
_p9k_prompt_prefix_left='${(e)_p9k_t['$(($#_p9k_t - __p9k_ksh_arrays))']}'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_p9k_init_ssh() {
|
|
|
|
_p9k_init_ssh() {
|
|
|
@ -4734,7 +4749,7 @@ _p9k_must_init() {
|
|
|
|
'${GITSTATUS_ENABLE_LOGGING}' '${GITSTATUS_DAEMON}' '${GITSTATUS_NUM_THREADS}'
|
|
|
|
'${GITSTATUS_ENABLE_LOGGING}' '${GITSTATUS_DAEMON}' '${GITSTATUS_NUM_THREADS}'
|
|
|
|
'${DEFAULT_USER}' '${ZLE_RPROMPT_INDENT}' '${P9K_SSH}' '${__p9k_ksh_arrays}'
|
|
|
|
'${DEFAULT_USER}' '${ZLE_RPROMPT_INDENT}' '${P9K_SSH}' '${__p9k_ksh_arrays}'
|
|
|
|
'${__p9k_sh_glob}' '${parameters[transient_rprompt]}' '${ITERM_SHELL_INTEGRATION_INSTALLED}'
|
|
|
|
'${__p9k_sh_glob}' '${parameters[transient_rprompt]}' '${ITERM_SHELL_INTEGRATION_INSTALLED}'
|
|
|
|
'v9')
|
|
|
|
'${PROMPT_EOL_MARK}' 'LANG' 'LC_ALL' 'LC_CTYPE' 'v9')
|
|
|
|
IFS=$'\2' param_sig="${(e)param_sig}"
|
|
|
|
IFS=$'\2' param_sig="${(e)param_sig}"
|
|
|
|
[[ $param_sig == $_p9k_param_sig ]] && return 1
|
|
|
|
[[ $param_sig == $_p9k_param_sig ]] && return 1
|
|
|
|
[[ -n $_p9k_param_sig ]] && _p9k_deinit
|
|
|
|
[[ -n $_p9k_param_sig ]] && _p9k_deinit
|
|
|
@ -5060,6 +5075,13 @@ typeset -gi __p9k_enabled=0
|
|
|
|
typeset -gi __p9k_configured=0
|
|
|
|
typeset -gi __p9k_configured=0
|
|
|
|
typeset -gri __p9k_instant_prompt_disabled=1
|
|
|
|
typeset -gri __p9k_instant_prompt_disabled=1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# `typeset -g` doesn't roundtrip in zsh prior to 5.4.
|
|
|
|
|
|
|
|
if is-at-least 5.4; then
|
|
|
|
|
|
|
|
typeset -gri __p9k_dumps_enabled=1
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
typeset -gri __p9k_dumps_enabled=0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
prompt_powerlevel9k_setup() {
|
|
|
|
prompt_powerlevel9k_setup() {
|
|
|
|
emulate -L zsh
|
|
|
|
emulate -L zsh
|
|
|
|
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
|
|
|
|
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
|
|
|
|