fix prompt_char (never showed error); unify options

pull/445/head
romkatv 5 years ago
parent 98c614b851
commit a9715367d4

@ -11,8 +11,6 @@ typeset -gr __p9k_zshrc_u=$__p9k_zd_u/.zshrc
typeset -gr __p9k_root_dir_u=${${${(q)__p9k_root_dir}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%} typeset -gr __p9k_root_dir_u=${${${(q)__p9k_root_dir}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%}
function _p9k_can_configure() { function _p9k_can_configure() {
emulate -L zsh
setopt extended_glob no_prompt_{bang,subst} prompt_percent
[[ $1 == '-q' ]] && local -i q=1 || local -i q=0 [[ $1 == '-q' ]] && local -i q=1 || local -i q=0
function $0_error() { function $0_error() {
(( q )) || print -rP "%1F[ERROR]%f %Bp10k configure%b: $1" >&2 (( q )) || print -rP "%1F[ERROR]%f %Bp10k configure%b: $1" >&2
@ -61,8 +59,7 @@ function _p9k_can_configure() {
} }
function p9k_configure() { function p9k_configure() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
( (
set -- -f set -- -f
source $__p9k_root_dir/internal/wizard.zsh source $__p9k_root_dir/internal/wizard.zsh

@ -590,8 +590,6 @@ function _p9k_init_icons() {
# Sadly, this is a part of public API. Its use is emphatically discouraged. # Sadly, this is a part of public API. Its use is emphatically discouraged.
function _p9k_print_icon() { function _p9k_print_icon() {
emulate -L zsh
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
_p9k_init_icons _p9k_init_icons
[[ -z $_p9k_locale ]] || local LC_ALL=$_p9k_locale [[ -z $_p9k_locale ]] || local LC_ALL=$_p9k_locale
local icon_name=$1 local icon_name=$1
@ -609,8 +607,6 @@ function _p9k_print_icon() {
# otherwise "print_icon" is used, which takes the users # otherwise "print_icon" is used, which takes the users
# overrides into account. # overrides into account.
function _p9k_get_icon_names() { function _p9k_get_icon_names() {
emulate -L zsh
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
_p9k_init_icons _p9k_init_icons
[[ -z $_p9k_locale ]] || local LC_ALL=$_p9k_locale [[ -z $_p9k_locale ]] || local LC_ALL=$_p9k_locale
# Iterate over a ordered list of keys of the icons array # Iterate over a ordered list of keys of the icons array

@ -89,8 +89,7 @@ typeset -grA __p9k_colors=(
# #
# Type `getColorCode background` or `getColorCode foreground` to see the list of predefined colors. # Type `getColorCode background` or `getColorCode foreground` to see the list of predefined colors.
function getColorCode() { function getColorCode() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
if (( ARGC == 1 )); then if (( ARGC == 1 )); then
case $1 in case $1 in
foreground) foreground)
@ -117,8 +116,7 @@ function getColorCode() {
# Sadly, this is a part of public API. Its use is emphatically discouraged. # Sadly, this is a part of public API. Its use is emphatically discouraged.
function print_icon() { function print_icon() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
(( $+functions[_p9k_print_icon] )) || source "${__p9k_root_dir}/internal/icons.zsh" (( $+functions[_p9k_print_icon] )) || source "${__p9k_root_dir}/internal/icons.zsh"
_p9k_print_icon "$@" _p9k_print_icon "$@"
} }
@ -129,8 +127,7 @@ function print_icon() {
# otherwise "print_icon" is used, which takes the users # otherwise "print_icon" is used, which takes the users
# overrides into account. # overrides into account.
function get_icon_names() { function get_icon_names() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
(( $+functions[_p9k_get_icon_names] )) || source "${__p9k_root_dir}/internal/icons.zsh" (( $+functions[_p9k_get_icon_names] )) || source "${__p9k_root_dir}/internal/icons.zsh"
_p9k_get_icon_names "$@" _p9k_get_icon_names "$@"
} }
@ -1542,8 +1539,9 @@ prompt_dir() {
# for "~[a/b]" it'll give the nonsensical "~[a". To solve this problem we have to # for "~[a/b]" it'll give the nonsensical "~[a". To solve this problem we have to
# repeat what "${(%):-%~}" does and hope that it produces the same result. # repeat what "${(%):-%~}" does and hope that it produces the same result.
local func='' local func=''
local -a parts=() reply=() local -a parts=()
for func in zsh_directory_name $zsh_directory_name_functions; do for func in zsh_directory_name $zsh_directory_name_functions; do
local reply=()
if (( $+functions[$func] )) && $func d $_p9k__pwd && [[ $p == '~['$reply[1]']'* ]]; then if (( $+functions[$func] )) && $func d $_p9k__pwd && [[ $p == '~['$reply[1]']'* ]]; then
parts+='~['$reply[1]']' parts+='~['$reply[1]']'
break break
@ -1905,7 +1903,6 @@ _p9k_prompt_docker_machine_init() {
# GO prompt # GO prompt
prompt_go_version() { prompt_go_version() {
_p9k_cached_cmd_stdout go version || return _p9k_cached_cmd_stdout go version || return
local -a match
[[ $_p9k_ret == (#b)*go([[:digit:].]##)* ]] || return [[ $_p9k_ret == (#b)*go([[:digit:].]##)* ]] || return
local v=$match[1] local v=$match[1]
if (( _POWERLEVEL9K_GO_VERSION_PROJECT_ONLY )); then if (( _POWERLEVEL9K_GO_VERSION_PROJECT_ONLY )); then
@ -2174,7 +2171,6 @@ function _p9k_nvm_ls_default() {
(( $#matches )) || return (( $#matches )) || return
local max path local max path
local -a match
for path in ${(Oa)matches}; do for path in ${(Oa)matches}; do
[[ ${path:t} == (#b)v(*).(*).(*) ]] || continue [[ ${path:t} == (#b)v(*).(*).(*) ]] || continue
v=${(j::)${(@l:6::0:)match}} v=${(j::)${(@l:6::0:)match}}
@ -2351,7 +2347,6 @@ instant_prompt_os_icon() { prompt_os_icon; }
# Segment to display PHP version number # Segment to display PHP version number
prompt_php_version() { prompt_php_version() {
_p9k_cached_cmd_stdout php --version || return _p9k_cached_cmd_stdout php --version || return
local -a match
[[ $_p9k_ret == (#b)(*$'\n')#(PHP [[:digit:].]##)* ]] || return [[ $_p9k_ret == (#b)(*$'\n')#(PHP [[:digit:].]##)* ]] || return
local v=$match[2] local v=$match[2]
_p9k_prompt_segment "$0" "fuchsia" "grey93" '' 0 '' "${v//\%/%%}" _p9k_prompt_segment "$0" "fuchsia" "grey93" '' 0 '' "${v//\%/%%}"
@ -2666,7 +2661,7 @@ prompt_rust_version() {
local rustc=$commands[rustc] toolchain deps=() local rustc=$commands[rustc] toolchain deps=()
if (( $+commands[ldd] )); then if (( $+commands[ldd] )); then
if ! _p9k_cache_stat_get $0_so $rustc; then if ! _p9k_cache_stat_get $0_so $rustc; then
local line match so local line so
for line in "${(@f)$(ldd $rustc 2>/dev/null)}"; do for line in "${(@f)$(ldd $rustc 2>/dev/null)}"; do
[[ $line == (#b)[[:space:]]#librustc_driver[^[:space:]]#.so' => '(*)' (0x'[[:xdigit:]]#')' ]] || continue [[ $line == (#b)[[:space:]]#librustc_driver[^[:space:]]#.so' => '(*)' (0x'[[:xdigit:]]#')' ]] || continue
so=$match[1] so=$match[1]
@ -2812,6 +2807,11 @@ instant_prompt_status() {
} }
prompt_prompt_char() { prompt_prompt_char() {
local saved=$_p9k__prompt_char_saved[1+!_p9k__status]
if [[ -n $saved ]]; then
_p9k__prompt+=$saved
return
fi
local -i len=$#_p9k__prompt local -i len=$#_p9k__prompt
if (( __p9k_sh_glob )); then if (( __p9k_sh_glob )); then
if (( _p9k__status )); then if (( _p9k__status )); then
@ -2854,7 +2854,7 @@ prompt_prompt_char() {
_p9k_prompt_segment $0_OK_VIVIS "$_p9k_color1" 76 '' 0 '${(M)${:-$_p9k__keymap$_p9k__region_active}:#(vicmd1|vivis?|vivli?)}' '' _p9k_prompt_segment $0_OK_VIVIS "$_p9k_color1" 76 '' 0 '${(M)${:-$_p9k__keymap$_p9k__region_active}:#(vicmd1|vivis?|vivli?)}' ''
fi fi
fi fi
typeset -g "_p9k__segment_val_${_p9k_prompt_side}[_p9k_segment_index]"=$_p9k__prompt[len+1,-1] _p9k__prompt_char_saved[1+!_p9k__status]=$_p9k__prompt[len+1,-1]
} }
instant_prompt_prompt_char() { instant_prompt_prompt_char() {
@ -3526,8 +3526,7 @@ function _p9k_maybe_ignore_git_repo() {
} }
function _p9k_vcs_resume() { function _p9k_vcs_resume() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
_p9k_maybe_ignore_git_repo _p9k_maybe_ignore_git_repo
@ -3861,7 +3860,6 @@ prompt_kubecontext() {
if ! _p9k_cache_stat_get $0 ${(s.:.)${KUBECONFIG:-$HOME/.kube/config}}; then if ! _p9k_cache_stat_get $0 ${(s.:.)${KUBECONFIG:-$HOME/.kube/config}}; then
local name namespace cluster user cloud_name cloud_account cloud_zone cloud_cluster text state local name namespace cluster user cloud_name cloud_account cloud_zone cloud_cluster text state
local -a match
() { () {
local cfg && cfg=(${(f)"$(kubectl config view -o=yaml 2>/dev/null)"}) || return local cfg && cfg=(${(f)"$(kubectl config view -o=yaml 2>/dev/null)"}) || return
local ctx=(${(@M)cfg:#current-context: [^\"\'\|\>]*}) local ctx=(${(@M)cfg:#current-context: [^\"\'\|\>]*})
@ -4356,16 +4354,6 @@ _p9k_prompt_net_iface_sync() {
} }
function _p9k_set_prompt() { function _p9k_set_prompt() {
local ifs=$IFS
IFS=$' \t\n\0'
if [[ $_p9k_refresh_reason == precmd ]]; then
local f_compute
for f_compute in "${_p9k__async_segments_compute[@]}"; do
_p9k_worker_invoke ${f_compute%% *} ${(e)f_compute}
done
fi
PROMPT= PROMPT=
RPROMPT= RPROMPT=
[[ $1 == instant_ ]] || PROMPT+='${$((_p9k_on_expand()))+}' [[ $1 == instant_ ]] || PROMPT+='${$((_p9k_on_expand()))+}'
@ -4508,7 +4496,6 @@ function _p9k_set_prompt() {
_p9k_prompt_side= _p9k_prompt_side=
(( $#_p9k_cache < _POWERLEVEL9K_MAX_CACHE_SIZE )) || _p9k_cache=() (( $#_p9k_cache < _POWERLEVEL9K_MAX_CACHE_SIZE )) || _p9k_cache=()
(( $#_p9k__cache_ephemeral < _POWERLEVEL9K_MAX_CACHE_SIZE )) || _p9k__cache_ephemeral=() (( $#_p9k__cache_ephemeral < _POWERLEVEL9K_MAX_CACHE_SIZE )) || _p9k__cache_ephemeral=()
IFS=$ifs
} }
_p9k_set_instant_prompt() { _p9k_set_instant_prompt() {
@ -4520,7 +4507,7 @@ _p9k_set_instant_prompt() {
RPROMPT=$saved_rprompt RPROMPT=$saved_rprompt
} }
typeset -gri __p9k_instant_prompt_version=17 typeset -gri __p9k_instant_prompt_version=18
_p9k_dump_instant_prompt() { _p9k_dump_instant_prompt() {
local user=${(%):-%n} local user=${(%):-%n}
@ -4543,7 +4530,7 @@ _p9k_dump_instant_prompt() {
display_v[2]=hide display_v[2]=hide
display_v[4]=hide display_v[4]=hide
>&$fd print -r -- "() { >&$fd print -r -- "() {
emulate -L zsh $__p9k_intro
(( ! \$+__p9k_instant_prompt_disabled )) || return (( ! \$+__p9k_instant_prompt_disabled )) || return
typeset -gi __p9k_instant_prompt_disabled=1 __p9k_instant_prompt_sourced=$__p9k_instant_prompt_version 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} && [[ -t 0 && -t 1 && -t 2 && \$ZSH_VERSION == ${(q)ZSH_VERSION} && \$ZSH_PATCHLEVEL == ${(q)ZSH_PATCHLEVEL} &&
@ -4591,12 +4578,11 @@ _p9k_dump_instant_prompt() {
local -A _p9k_display_k=('${(j: :)${(@q)${(kv)_p9k_display_k}}}') local -A _p9k_display_k=('${(j: :)${(@q)${(kv)_p9k_display_k}}}')
local -a _p9k__display_v=('${(j: :)${(@q)display_v}}') local -a _p9k__display_v=('${(j: :)${(@q)display_v}}')
function p10k() { function p10k() {
emulate -L zsh '$__p9k_intro'
setopt no_hist_expand extended_glob prompt_percent prompt_subst no_aliases
[[ $1 == display ]] || return [[ $1 == display ]] || return
shift shift
local -i OPTIND k dump local -i k dump
local OPTARG opt match MATCH prev new pair list name var local opt prev new pair list name var
while getopts ":ha" opt; do while getopts ":ha" opt; do
case $opt in case $opt in
a) dump=1;; a) dump=1;;
@ -4783,11 +4769,11 @@ _p9k_dump_instant_prompt() {
_p9k_preinit _p9k_preinit
fi fi
function _p9k_instant_prompt_precmd_first() { function _p9k_instant_prompt_precmd_first() {
emulate -L zsh '$__p9k_intro'
function _p9k_instant_prompt_sched_last() { function _p9k_instant_prompt_sched_last() {
(( $+__p9k_instant_prompt_active )) || return 0 (( $+__p9k_instant_prompt_active )) || return 0
() { () {
emulate -L zsh '$__p9k_intro'
exec 0<&$__p9k_fd_0 1>&$__p9k_fd_1 2>&$__p9k_fd_2 {__p9k_fd_0}>&- {__p9k_fd_1}>&- {__p9k_fd_2}>&- exec 0<&$__p9k_fd_0 1>&$__p9k_fd_1 2>&$__p9k_fd_2 {__p9k_fd_0}>&- {__p9k_fd_1}>&- {__p9k_fd_2}>&-
unset __p9k_fd_0 __p9k_fd_1 __p9k_fd_2 __p9k_instant_prompt_active unset __p9k_fd_0 __p9k_fd_1 __p9k_fd_2 __p9k_instant_prompt_active
typeset -gi __p9k_instant_prompt_erased=1 typeset -gi __p9k_instant_prompt_erased=1
@ -5059,7 +5045,6 @@ function _p9k_maybe_dump() {
fi fi
fi fi
elif (( _p9k__state_dump_scheduled || ! (_p9k__instant_prompt_disabled || $+_p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]) )); then elif (( _p9k__state_dump_scheduled || ! (_p9k__instant_prompt_disabled || $+_p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]) )); then
setopt no_bg_nice
( (
if ! (( _p9k__instant_prompt_disabled || $+_p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig] )); then if ! (( _p9k__instant_prompt_disabled || $+_p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig] )); then
_p9k_set_instant_prompt _p9k_set_instant_prompt
@ -5079,8 +5064,7 @@ function _p9k_on_expand() {
(( _p9k__expanded && ! $+__p9k_instant_prompt_active )) && return (( _p9k__expanded && ! $+__p9k_instant_prompt_active )) && return
() { () {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
_p9k_maybe_dump _p9k_maybe_dump
(( $+__p9k_instant_prompt_active )) && _p9k_clear_instant_prompt (( $+__p9k_instant_prompt_active )) && _p9k_clear_instant_prompt
@ -5169,8 +5153,7 @@ function _p9k_on_expand() {
functions -M _p9k_on_expand functions -M _p9k_on_expand
_p9k_precmd_impl() { _p9k_precmd_impl() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
(( __p9k_enabled )) || return (( __p9k_enabled )) || return
@ -5243,6 +5226,11 @@ _p9k_precmd_impl() {
_p9k__pwd=${(%):-%/} _p9k__pwd=${(%):-%/}
_p9k__pwd_a=${_p9k__pwd:A} _p9k__pwd_a=${_p9k__pwd:A}
local f_compute
for f_compute in "${_p9k__async_segments_compute[@]}"; do
_p9k_worker_invoke ${f_compute%% *} ${(e)f_compute}
done
_p9k_refresh_reason=precmd _p9k_refresh_reason=precmd
_p9k_set_prompt _p9k_set_prompt
_p9k_refresh_reason='' _p9k_refresh_reason=''
@ -5265,8 +5253,7 @@ _p9k_precmd_impl() {
_p9k_trapint() { _p9k_trapint() {
if (( __p9k_enabled )); then if (( __p9k_enabled )); then
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
zle && _p9k_on_widget_zle-line-finish int zle && _p9k_on_widget_zle-line-finish int
fi fi
return 0 return 0
@ -5290,6 +5277,7 @@ _p9k_precmd() {
function _p9k_reset_prompt() { function _p9k_reset_prompt() {
if zle && [[ -z $_p9k__line_finished ]]; then if zle && [[ -z $_p9k__line_finished ]]; then
setopt prompt_subst
(( __p9k_ksh_arrays )) && setopt ksh_arrays (( __p9k_ksh_arrays )) && setopt ksh_arrays
(( __p9k_sh_glob )) && setopt sh_glob (( __p9k_sh_glob )) && setopt sh_glob
(( _p9k__can_hide_cursor )) && echoti civis (( _p9k__can_hide_cursor )) && echoti civis
@ -5319,6 +5307,7 @@ typeset -g _p9k__param_pat
typeset -g _p9k__param_sig typeset -g _p9k__param_sig
_p9k_init_vars() { _p9k_init_vars() {
typeset -ga _p9k__prompt_char_saved
typeset -g _p9k__worker_pid typeset -g _p9k__worker_pid
typeset -g _p9k__worker_req_fd typeset -g _p9k__worker_req_fd
typeset -g _p9k__worker_resp_fd typeset -g _p9k__worker_resp_fd
@ -5911,9 +5900,10 @@ function _p9k_parse_buffer() {
[[ ${2:-0} == <-> ]] || return 2 [[ ${2:-0} == <-> ]] || return 2
local rcquotes local rcquotes
[[ -o rcquotes ]] && rcquotes=(-o rcquotes) [[ -o rcquotes ]] && rcquotes=rcquotes
emulate -L zsh -o extended_glob -o no_nomatch $rcquotes eval $__p9k_intro
setopt no_nomatch $rcquotes
typeset -ga P9K_COMMANDS=() typeset -ga P9K_COMMANDS=()
@ -6230,8 +6220,7 @@ function _p9k_widget_hook() {
fi fi
fi fi
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
(( _p9k__restore_prompt_fd )) && _p9k_restore_prompt $_p9k__restore_prompt_fd (( _p9k__restore_prompt_fd )) && _p9k_restore_prompt $_p9k__restore_prompt_fd
__p9k_reset_state=1 __p9k_reset_state=1
local pat idx var local pat idx var
@ -6305,8 +6294,7 @@ function _p9k_wrap_widgets() {
} }
function _p9k_restore_prompt() { function _p9k_restore_prompt() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
{ {
(( _p9k__must_restore_prompt )) || return (( _p9k__must_restore_prompt )) || return
_p9k__must_restore_prompt=0 _p9k__must_restore_prompt=0
@ -6664,7 +6652,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1 [[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit _p9k_deinit
fi fi
_p9k__param_pat=$'v28\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' _p9k__param_pat=$'v29\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1' _p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1' _p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
_p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays' _p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'
@ -7095,13 +7083,12 @@ prompt_powerlevel9k_setup() {
(( __p9k_enabled )) && return (( __p9k_enabled )) && return
prompt_opts=(percent subst) prompt_opts=(percent subst)
(( $+__p9k_instant_prompt_active )) || { if (( ! $+__p9k_instant_prompt_active )); then
[[ ! -o prompt_sp ]] || prompt_opts+=sp prompt_opts+=sp
[[ ! -o prompt_cr ]] || prompt_opts+=cr prompt_opts+=cr
} fi
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
prompt_powerlevel9k_teardown prompt_powerlevel9k_teardown
__p9k_enabled=1 __p9k_enabled=1
typeset -ga preexec_functions=(_p9k_preexec1 $preexec_functions _p9k_preexec2) typeset -ga preexec_functions=(_p9k_preexec1 $preexec_functions _p9k_preexec2)
@ -7109,8 +7096,7 @@ prompt_powerlevel9k_setup() {
} }
prompt_powerlevel9k_teardown() { prompt_powerlevel9k_teardown() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
add-zsh-hook -D precmd '(_p9k_|powerlevel9k_)*' add-zsh-hook -D precmd '(_p9k_|powerlevel9k_)*'
add-zsh-hook -D preexec '(_p9k_|powerlevel9k_)*' add-zsh-hook -D preexec '(_p9k_|powerlevel9k_)*'
PROMPT='%m%# ' PROMPT='%m%# '
@ -7184,7 +7170,7 @@ Example: 'core' segment tells you if there is a file name 'core' in the current
else else
local state=PROTECTED local state=PROTECTED
fi fi
p10k segment -s \\\$state -i '⭐' -f blue -t \\\${size[1]}b p10k segment -s \$state -i '⭐' -f blue -t \${size[1]}b
} }
To enable this segment, add 'core' to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or To enable this segment, add 'core' to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or
@ -7223,8 +7209,8 @@ prompt is refreshed.
Usage: %2Fp10k%f %Bdisplay%b -a [part-pattern]... Usage: %2Fp10k%f %Bdisplay%b -a [part-pattern]...
Populate array \\\`reply\\\` with states of prompt parts matching the patterns. Populate array \`reply\` with states of prompt parts matching the patterns.
If no patterns are supplied, assume \\\`*\\\`. If no patterns are supplied, assume \`*\`.
Parts: Parts:
empty_line empty line (duh) empty_line empty line (duh)
@ -7244,7 +7230,7 @@ Part States:
show the part is displayed show the part is displayed
hide the part is not displayed hide the part is not displayed
print the part is printed in precmd; only applicable to empty_line and print the part is printed in precmd; only applicable to empty_line and
ruler; looks better than show after calling \\\`clear\\\`; unlike ruler; looks better than show after calling \`clear\`; unlike
show, the effects of print cannot be undone with hide show, the effects of print cannot be undone with hide
part-pattern is a glob pattern for parts. Examples: part-pattern is a glob pattern for parts. Examples:
@ -7267,7 +7253,7 @@ Example: Print the state of all prompt parts:
local -A reply local -A reply
p10k display -a '*' p10k display -a '*'
printf '%%32s = %%q\n' \\\${(@kv)reply} printf '%%32s = %%q\\n' \${(@kv)reply}
" "
# 0 -- reset-prompt not blocked # 0 -- reset-prompt not blocked
@ -7278,8 +7264,7 @@ typeset -gi __p9k_reset_state
function p10k() { function p10k() {
[[ $# != 1 || $1 != finalize ]] || { p10k-instant-prompt-finalize; return 0 } [[ $# != 1 || $1 != finalize ]] || { p10k-instant-prompt-finalize; return 0 }
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob prompt_percent prompt_subst no_aliases
if (( !ARGC )); then if (( !ARGC )); then
print -rP -- $__p9k_p10k_usage >&2 print -rP -- $__p9k_p10k_usage >&2
@ -7332,8 +7317,8 @@ function p10k() {
return 1 return 1
fi fi
shift shift
local -i OPTIND k dump local -i k dump
local OPTARG opt match MATCH prev new pair list name var local opt prev new pair list name var
while getopts ':ha' opt; do while getopts ':ha' opt; do
case $opt in case $opt in
a) dump=1;; a) dump=1;;

@ -1,8 +1,3 @@
emulate -L zsh
setopt noaliases
() {
setopt extended_glob no_prompt_{bang,subst} prompt_percent typeset_silent
zmodload zsh/langinfo zmodload zsh/langinfo
if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then
local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8} local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8}
@ -1902,5 +1897,3 @@ change_zshrc || return
print -rP "" print -rP ""
flowing +c File feature requests and bug reports at "$(href https://github.com/romkatv/powerlevel10k/issues)." flowing +c File feature requests and bug reports at "$(href https://github.com/romkatv/powerlevel10k/issues)."
print -rP "" print -rP ""
} "$@"

@ -5,8 +5,6 @@ function _p9k_worker_main() {
exec 0<$_p9k__worker_file_prefix.fifo || return exec 0<$_p9k__worker_file_prefix.fifo || return
zf_rm $_p9k__worker_file_prefix.fifo || return zf_rm $_p9k__worker_file_prefix.fifo || return
typeset -g IFS=$' \t\n\0'
local -i reset local -i reset
local req fd local req fd
local -a ready local -a ready
@ -87,15 +85,12 @@ function _p9k_worker_invoke() {
} }
function _p9k_worker_cleanup() { function _p9k_worker_cleanup() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
[[ $_p9k__worker_shell_pid == $sysparams[pid] ]] && _p9k_worker_stop [[ $_p9k__worker_shell_pid == $sysparams[pid] ]] && _p9k_worker_stop
return 0 return 0
} }
function _p9k_worker_stop() { function _p9k_worker_stop() {
emulate -L zsh
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
add-zsh-hook -D zshexit _p9k_worker_cleanup add-zsh-hook -D zshexit _p9k_worker_cleanup
[[ -n $_p9k__worker_resp_fd ]] && zle -F $_p9k__worker_resp_fd [[ -n $_p9k__worker_resp_fd ]] && zle -F $_p9k__worker_resp_fd
[[ -n $_p9k__worker_resp_fd ]] && exec {_p9k__worker_resp_fd}>&- [[ -n $_p9k__worker_resp_fd ]] && exec {_p9k__worker_resp_fd}>&-
@ -111,8 +106,7 @@ function _p9k_worker_stop() {
} }
function _p9k_worker_receive() { function _p9k_worker_receive() {
emulate -L zsh eval $__p9k_intro
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
[[ -z $_p9k__worker_resp_fd ]] && return [[ -z $_p9k__worker_resp_fd ]] && return
@ -179,7 +173,7 @@ function _p9k_worker_receive() {
} }
function _p9k_worker_start() { function _p9k_worker_start() {
setopt no_bgnice monitor setopt monitor || return
{ {
[[ -n $_p9k__worker_resp_fd ]] && return [[ -n $_p9k__worker_resp_fd ]] && return
_p9k__worker_file_prefix=${TMPDIR:-/tmp}/p10k.worker.$EUID.$$.$EPOCHSECONDS _p9k__worker_file_prefix=${TMPDIR:-/tmp}/p10k.worker.$EUID.$$.$EPOCHSECONDS

@ -18,10 +18,14 @@
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
(( $+__p9k_root_dir )) || typeset -gr __p9k_root_dir=${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}} (( $+__p9k_root_dir )) || typeset -gr __p9k_root_dir=${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}
(( $+__p9k_intro )) || typeset -gr __p9k_intro='emulate -L zsh -o no_hist_expand -o extended_glob -o no_prompt_bang -o prompt_percent -o no_prompt_subst -o no_aliases -o no_bg_nice -o typeset_silent
local -a match mbegin mend reply
local -i MBEGIN MEND OPTIND
local MATCH REPLY OPTARG IFS=$'\'' \t\n\0'\''
[[ -z $_p9k_locale ]] || local LC_ALL=$_p9k_locale'
() { () {
emulate -L zsh eval $__p9k_intro
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 0 return 0
@ -40,7 +44,8 @@
source $__p9k_root_dir/internal/p10k.zsh || true source $__p9k_root_dir/internal/p10k.zsh || true
} }
(( ! $+__p9k_instant_prompt_active )) || unsetopt local_options prompt_cr prompt_sp unsetopt local_options
(( $+__p9k_instant_prompt_active )) && unsetopt prompt_cr prompt_sp || setopt prompt_cr prompt_sp
(( ${#__p9k_src_opts} )) && setopt ${__p9k_src_opts[@]} (( ${#__p9k_src_opts} )) && setopt ${__p9k_src_opts[@]}
'builtin' 'unset' '__p9k_src_opts' 'builtin' 'unset' '__p9k_src_opts'

Loading…
Cancel
Save