aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes5
-rw-r--r--README.md2
-rw-r--r--config/p10k-classic.zsh33
-rw-r--r--config/p10k-lean.zsh29
-rw-r--r--config/p10k-pure.zsh15
-rw-r--r--config/p10k-rainbow.zsh32
-rwxr-xr-xgitstatus/bin/gitstatusd-android-aarch64bin1076696 -> 1084840 bytes
-rwxr-xr-xgitstatus/bin/gitstatusd-cygwin_nt-10.0-x86_64bin2167296 -> 2176512 bytes
-rwxr-xr-xgitstatus/bin/gitstatusd-darwin-x86_64bin2095092 -> 2091052 bytes
-rwxr-xr-xgitstatus/bin/gitstatusd-freebsd-amd64bin3268488 -> 3272552 bytes
-rwxr-xr-xgitstatus/bin/gitstatusd-linux-aarch64bin2286400 -> 2278160 bytes
-rwxr-xr-xgitstatus/bin/gitstatusd-linux-armv7lbin1877556 -> 1885724 bytes
-rwxr-xr-xgitstatus/bin/gitstatusd-linux-x86_64bin2340104 -> 2335976 bytes
-rwxr-xr-xgitstatus/bin/gitstatusd-linux-x86_64-staticbin2065632 -> 2065600 bytes
-rwxr-xr-xgitstatus/bin/gitstatusd-msys_nt-10.0-x86_64bin0 -> 2004992 bytes
-rw-r--r--gitstatus/gitstatus.plugin.zsh30
-rw-r--r--internal/p10k.zsh1021
-rwxr-xr-xinternal/wizard.zsh450
-rw-r--r--powerlevel10k.zsh-theme2
19 files changed, 1040 insertions, 579 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..41b2d3a8
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,5 @@
+* text=auto
+*.zsh text eol=lf
+*.zsh-theme text eol=lf
+/prompt_powerlevel9k_setup text eol=lf
+/prompt_powerlevel10k_setup text eol=lf
diff --git a/README.md b/README.md
index a74372aa..75a88e0c 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,7 @@ This is the simplest kind of installation and it works even if you are using a p
### Oh My Zsh
```zsh
-git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
+git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
```
Set `ZSH_THEME=powerlevel10k/powerlevel10k` in your `~/.zshrc`.
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh
index 5f1424ab..fd8a446f 100644
--- a/config/p10k-classic.zsh
+++ b/config/p10k-classic.zsh
@@ -65,6 +65,7 @@
context # user@hostname
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger)
+ vi_mode # vi mode (you don't need this if you've enabled prompt_char)
# vpn_ip # virtual private network indicator
# ram # free RAM
# load # CPU load
@@ -512,6 +513,23 @@
# Custom icon.
# typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]###########
+ # Text and color for normal (a.k.a. command) vi mode.
+ typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
+ typeset -g POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND=106
+ # Text and color for visual vi mode.
+ typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL
+ typeset -g POWERLEVEL9K_VI_MODE_VISUAL_FOREGROUND=68
+ # Text and color for overtype (a.k.a. overwrite and replace) vi mode.
+ typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE
+ typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_FOREGROUND=172
+ # Text and color for insert vi mode.
+ typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING=
+ typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=66
+
+ # Custom icon.
+ # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
######################################[ ram: free RAM ]#######################################
# RAM color.
typeset -g POWERLEVEL9K_RAM_FOREGROUND=66
@@ -839,6 +857,15 @@
# typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208
# typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
+ # when accepting a command line. Supported values:
+ #
+ # - off: Don't change prompt when accepting a command line.
+ # - always: Trim down prompt when accepting a command line.
+ # - same-dir: Trim down prompt when accepting a command line unless this is the first command
+ # typed after changing current working directory.
+ typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
+
# Instant prompt mode.
#
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
@@ -850,6 +877,12 @@
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
+
+ # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
+ # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
+ # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
+ # really need it.
+ typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
}
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh
index e06eb555..8d321ca4 100644
--- a/config/p10k-lean.zsh
+++ b/config/p10k-lean.zsh
@@ -148,6 +148,20 @@
# Add an empty line before each prompt.
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
+ # Connect left prompt lines with these symbols.
+ typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=
+ typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX=
+ typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=
+ # Connect right prompt lines with these symbols.
+ typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX=
+ typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX=
+ typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=
+
+ # The left end of left prompt.
+ typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=
+ # The right end of right prompt.
+ typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL=
+
# Ruler, a.k.a. the horizontal line before each prompt. If you set it to true, you'll
# probably want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false above and
# POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below.
@@ -819,6 +833,15 @@
# typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208
# typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
+ # when accepting a command line. Supported values:
+ #
+ # - off: Don't change prompt when accepting a command line.
+ # - always: Trim down prompt when accepting a command line.
+ # - same-dir: Trim down prompt when accepting a command line unless this is the first command
+ # typed after changing current working directory.
+ typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
+
# Instant prompt mode.
#
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
@@ -830,6 +853,12 @@
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
+
+ # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
+ # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
+ # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
+ # really need it.
+ typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
}
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
diff --git a/config/p10k-pure.zsh b/config/p10k-pure.zsh
index c91886a7..6c717a45 100644
--- a/config/p10k-pure.zsh
+++ b/config/p10k-pure.zsh
@@ -125,6 +125,15 @@
# Remove space between '⇣' and '⇡'.
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${P9K_CONTENT/⇣* ⇡/⇣⇡}'
+ # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
+ # when accepting a command line. Supported values:
+ #
+ # - off: Don't change prompt when accepting a command line.
+ # - always: Trim down prompt when accepting a command line.
+ # - same-dir: Trim down prompt when accepting a command line unless this is the first command
+ # typed after changing current working directory.
+ typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
+
# Instant prompt mode.
#
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
@@ -136,6 +145,12 @@
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
+
+ # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
+ # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
+ # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
+ # really need it.
+ typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
}
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh
index c1e70030..f64c363d 100644
--- a/config/p10k-rainbow.zsh
+++ b/config/p10k-rainbow.zsh
@@ -65,6 +65,7 @@
context # user@hostname
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger)
+ vi_mode # vi mode (you don't need this if you've enabled prompt_char)
# vpn_ip # virtual private network indicator
# ram # free RAM
# load # CPU load
@@ -511,6 +512,22 @@
# Custom icon.
# typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]###########
+ # Foreground color.
+ typeset -g POWERLEVEL9K_VI_MODE_FOREGROUND=0
+ # Text and color for normal (a.k.a. command) vi mode.
+ typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
+ typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2
+ # Text and color for visual vi mode.
+ typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL
+ typeset -g POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=4
+ # Text and color for overtype (a.k.a. overwrite and replace) vi mode.
+ typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE
+ typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=3
+ # Text and color for insert vi mode.
+ typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING=
+ typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=8
+
######################################[ ram: free RAM ]#######################################
# RAM color.
# typeset -g POWERLEVEL9K_RAM_FOREGROUND=0
@@ -867,6 +884,15 @@
# typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=3
# typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
+ # when accepting a command line. Supported values:
+ #
+ # - off: Don't change prompt when accepting a command line.
+ # - always: Trim down prompt when accepting a command line.
+ # - same-dir: Trim down prompt when accepting a command line unless this is the first command
+ # typed after changing current working directory.
+ typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
+
# Instant prompt mode.
#
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
@@ -878,6 +904,12 @@
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
+
+ # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
+ # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
+ # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
+ # really need it.
+ typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
}
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
diff --git a/gitstatus/bin/gitstatusd-android-aarch64 b/gitstatus/bin/gitstatusd-android-aarch64
index e9b22e72..cdea703e 100755
--- a/gitstatus/bin/gitstatusd-android-aarch64
+++ b/gitstatus/bin/gitstatusd-android-aarch64
Binary files differ
diff --git a/gitstatus/bin/gitstatusd-cygwin_nt-10.0-x86_64 b/gitstatus/bin/gitstatusd-cygwin_nt-10.0-x86_64
index a1baa948..0568ca78 100755
--- a/gitstatus/bin/gitstatusd-cygwin_nt-10.0-x86_64
+++ b/gitstatus/bin/gitstatusd-cygwin_nt-10.0-x86_64
Binary files differ
diff --git a/gitstatus/bin/gitstatusd-darwin-x86_64 b/gitstatus/bin/gitstatusd-darwin-x86_64
index dab60fc7..17b0ddcf 100755
--- a/gitstatus/bin/gitstatusd-darwin-x86_64
+++ b/gitstatus/bin/gitstatusd-darwin-x86_64
Binary files differ
diff --git a/gitstatus/bin/gitstatusd-freebsd-amd64 b/gitstatus/bin/gitstatusd-freebsd-amd64
index de7e0f24..f164a48e 100755
--- a/gitstatus/bin/gitstatusd-freebsd-amd64
+++ b/gitstatus/bin/gitstatusd-freebsd-amd64
Binary files differ
diff --git a/gitstatus/bin/gitstatusd-linux-aarch64 b/gitstatus/bin/gitstatusd-linux-aarch64
index b99ecfee..af762125 100755
--- a/gitstatus/bin/gitstatusd-linux-aarch64
+++ b/gitstatus/bin/gitstatusd-linux-aarch64
Binary files differ
diff --git a/gitstatus/bin/gitstatusd-linux-armv7l b/gitstatus/bin/gitstatusd-linux-armv7l
index 3d301aa9..bef8cc66 100755
--- a/gitstatus/bin/gitstatusd-linux-armv7l
+++ b/gitstatus/bin/gitstatusd-linux-armv7l
Binary files differ
diff --git a/gitstatus/bin/gitstatusd-linux-x86_64 b/gitstatus/bin/gitstatusd-linux-x86_64
index 5538aa05..8f10274d 100755
--- a/gitstatus/bin/gitstatusd-linux-x86_64
+++ b/gitstatus/bin/gitstatusd-linux-x86_64
Binary files differ
diff --git a/gitstatus/bin/gitstatusd-linux-x86_64-static b/gitstatus/bin/gitstatusd-linux-x86_64-static
index b561edd9..46466532 100755
--- a/gitstatus/bin/gitstatusd-linux-x86_64-static
+++ b/gitstatus/bin/gitstatusd-linux-x86_64-static
Binary files differ
diff --git a/gitstatus/bin/gitstatusd-msys_nt-10.0-x86_64 b/gitstatus/bin/gitstatusd-msys_nt-10.0-x86_64
new file mode 100755
index 00000000..f74138e3
--- /dev/null
+++ b/gitstatus/bin/gitstatusd-msys_nt-10.0-x86_64
Binary files differ
diff --git a/gitstatus/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh
index d64421db..bdc8b7c3 100644
--- a/gitstatus/gitstatus.plugin.zsh
+++ b/gitstatus/gitstatus.plugin.zsh
@@ -273,10 +273,19 @@ function _gitstatus_process_response() {
# -d INT Report at most this many untracked files; negative value means infinity.
# Defaults to 1.
#
-# -m INT If a repo has more files in its index than this, override -u and -d (but not -s)
-# with zeros. Negative value means infinity. Defaults to -1.
+# -m INT Report -1 unstaged, untracked and conflicted if there are more than this many
+# files in the index. Negative value means infinity. Defaults to -1.
#
# -e Count files within untracked directories like `git status --untracked-files`.
+#
+# -U Unless this option is specified, report zero untracked files for repositories
+# with status.showUntrackedFiles = false.
+#
+# -W Unless this option is specified, report zero untracked files for repositories
+# with bash.showUntrackedFiles = false.
+#
+# -D Unless this option is specified, report zero staged, unstaged and conflicted
+# changes for repositories with bash.showDirtyState = false.
function gitstatus_start() {
emulate -L zsh
setopt err_return no_unset no_bg_nice
@@ -289,9 +298,9 @@ function gitstatus_start() {
local -i max_num_untracked=1
local -i dirty_max_index_size=-1
local -i async
- local recurse_untracked_dirs
+ local -a extra_flags=()
while true; do
- getopts "t:s:u:c:d:m:ea" opt || break
+ getopts "t:s:u:c:d:m:eaUWD" opt || break
case $opt in
a) async=1;;
t) timeout=$OPTARG;;
@@ -300,8 +309,14 @@ function gitstatus_start() {
c) max_num_conflicted=$OPTARG;;
d) max_num_untracked=$OPTARG;;
m) dirty_max_index_size=$OPTARG;;
- e) recurse_untracked_dirs='--recurse-untracked-dirs';;
- +e) recurse_untracked_dirs=;;
+ e) extra_flags+='--recurse-untracked-dirs';;
+ +e) extra_flags=(${(@)extra_flags:#--recurse-untracked-dirs});;
+ U) extra_flags+='--ignore-status-show-untracked-files';;
+ +U) extra_flags=(${(@)extra_flags:#--ignore-status-show-untracked-files});;
+ W) extra_flags+='--ignore-bash-show-untracked-files';;
+ +W) extra_flags=(${(@)extra_flags:#--ignore-bash-show-untracked-files});;
+ D) extra_flags+='--ignore-bash-show-dirty-state';;
+ +D) extra_flags=(${(@)extra_flags:#--ignore-bash-show-dirty-state});;
?) return 1;;
esac
done
@@ -346,6 +361,7 @@ function gitstatus_start() {
[[ -n $daemon ]] || {
os="$(uname -s)" && [[ -n $os ]]
[[ $os != Linux || "$(uname -o)" != Android ]] || os=Android
+ [[ $os != (MINGW64_NT-10.0|MSYS_NT-10.0)* ]] || os=MSYS_NT-10.0
local arch && arch="$(uname -m)" && [[ -n $arch ]]
daemon=$_gitstatus_plugin_dir/bin/gitstatusd-${os:l}-${arch:l}
}
@@ -380,7 +396,7 @@ function gitstatus_start() {
--max-num-untracked=${(q)max_num_untracked}
--dirty-max-index-size=${(q)dirty_max_index_size}
--log-level=${(q)log_level:-INFO}
- $recurse_untracked_dirs)
+ $extra_flags)
local cmd="
exec >&4
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 58ce5321..91cf2040 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -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
@@ -347,15 +347,15 @@ _p9k_param() {
_p9k_ret[-1,-1]=''
else
if [[ $1 == (#b)prompt_([a-z0-9_]#)(*) ]]; then
- local var=POWERLEVEL9K_${(U)match[1]}$match[2]_$2
+ local var=_POWERLEVEL9K_${(U)match[1]}$match[2]_$2
if (( $+parameters[$var] )); then
_p9k_ret=${(P)var}
else
- var=POWERLEVEL9K_${(U)match[1]%_}_$2
+ var=_POWERLEVEL9K_${(U)match[1]%_}_$2
if (( $+parameters[$var] )); then
_p9k_ret=${(P)var}
else
- var=POWERLEVEL9K_$2
+ var=_POWERLEVEL9K_$2
if (( $+parameters[$var] )); then
_p9k_ret=${(P)var}
else
@@ -364,7 +364,7 @@ _p9k_param() {
fi
fi
else
- local var=POWERLEVEL9K_$2
+ local var=_POWERLEVEL9K_$2
if (( $+parameters[$var] )); then
_p9k_ret=${(P)var}
else
@@ -409,7 +409,7 @@ _p9k_translate_color() {
fi
}
-# _p9k_param prompt_foo_BAR BACKGROUND red
+# _p9k_color prompt_foo_BAR BACKGROUND red
_p9k_color() {
local key="_p9k_color ${(pj:\0:)*}"
_p9k_ret=$_p9k_cache[$key]
@@ -434,11 +434,11 @@ _p9k_vcs_style() {
_p9k_background $_p9k_ret
style+=$_p9k_ret
- local var=POWERLEVEL9K_VCS_${1}_${2}FORMAT_FOREGROUND
+ local var=_POWERLEVEL9K_VCS_${1}_${2}FORMAT_FOREGROUND
if (( $+parameters[$var] )); then
_p9k_translate_color "${(P)var}"
else
- var=POWERLEVEL9K_VCS_${2}FORMAT_FOREGROUND
+ var=_POWERLEVEL9K_VCS_${2}FORMAT_FOREGROUND
if (( $+parameters[$var] )); then
_p9k_translate_color "${(P)var}"
else
@@ -616,7 +616,7 @@ _p9k_left_prompt_segment() {
fi
p+="\${_p9k_c::=$content_exp_}"
- p+='${_p9k_e::=${${__p9k_s_'${${1#prompt_}%%[A-Z_]#}'+00}:-'
+ p+='${_p9k_e::=${${_p9k__'${_p9k_line_index}l${${1#prompt_}%%[A-Z_]#}'+00}:-'
if (( has_icon == -1 )); then
p+='${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}'
else
@@ -837,7 +837,7 @@ _p9k_right_prompt_segment() {
fi
p+="\${_p9k_c::=$content_exp_}"
- p+='${_p9k_e::=${${__p9k_s_'${${1#prompt_}%%[A-Z_]#}'+00}:-'
+ p+='${_p9k_e::=${${_p9k__'${_p9k_line_index}r${${1#prompt_}%%[A-Z_]#}'+00}:-'
if (( has_icon == -1 )); then
p+='${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}'
else
@@ -1134,7 +1134,7 @@ prompt_battery() {
;;
*)
- return
+ return 0
;;
esac
@@ -1212,7 +1212,7 @@ prompt_context() {
fi
if [[ -z $content ]]; then
- local var=POWERLEVEL9K_CONTEXT_${state}_TEMPLATE
+ local var=_POWERLEVEL9K_CONTEXT_${state}_TEMPLATE
if (( $+parameters[$var] )); then
[[ -z $_p9k_locale ]] || local LC_ALL=$_p9k_locale
content=${(P)var}
@@ -1269,7 +1269,7 @@ instant_prompt_host() { prompt_host; }
# the output in a segment.
_p9k_custom_prompt() {
local segment_name=${1:u}
- local command=POWERLEVEL9K_CUSTOM_${segment_name}
+ local command=_POWERLEVEL9K_CUSTOM_${segment_name}
command=${(P)command}
local cmd="${(Q)${(Az)command}[1]}"
(( $+functions[$cmd] || $+commands[$cmd] )) || return
@@ -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
@@ -2885,10 +2885,18 @@ function _p9k_vcs_render() {
return 0
}
+function _p9k_maybe_ignore_git_repo() {
+ if [[ $VCS_STATUS_RESULT == ok-* && $VCS_STATUS_WORKDIR == $~_POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN ]]; then
+ VCS_STATUS_RESULT=norepo${VCS_STATUS_RESULT#ok}
+ fi
+}
+
function _p9k_vcs_resume() {
emulate -L zsh
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
+ _p9k_maybe_ignore_git_repo
+
if [[ $VCS_STATUS_RESULT == ok-async ]]; then
local latency=$((EPOCHREALTIME - _p9k__gitstatus_start_time))
if (( latency > _POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS )); then
@@ -2912,6 +2920,7 @@ function _p9k_vcs_resume() {
unset _p9k__gitstatus_next_dir
unset VCS_STATUS_RESULT
else
+ _p9k_maybe_ignore_git_repo
case $VCS_STATUS_RESULT in
tout) _p9k__gitstatus_next_dir=''; _p9k__gitstatus_start_time=$EPOCHREALTIME;;
norepo-sync) _p9k_vcs_status_purge $_p9k__gitstatus_next_dir; unset _p9k__gitstatus_next_dir;;
@@ -2932,6 +2941,7 @@ function _p9k_vcs_gitstatus() {
local -F timeout=_POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS
if ! _p9k_vcs_status_for_dir $dir; then
gitstatus_query -d $dir -t $timeout -p -c '_p9k_vcs_resume 0' POWERLEVEL9K || return 1
+ _p9k_maybe_ignore_git_repo
case $VCS_STATUS_RESULT in
tout) _p9k__gitstatus_next_dir=''; _p9k__gitstatus_start_time=$EPOCHREALTIME; return 0;;
norepo-sync) return 0;;
@@ -2952,6 +2962,7 @@ function _p9k_vcs_gitstatus() {
unset VCS_STATUS_RESULT
return 1
fi
+ _p9k_maybe_ignore_git_repo
case $VCS_STATUS_RESULT in
tout) _p9k__gitstatus_next_dir=''; _p9k__gitstatus_start_time=$EPOCHREALTIME;;
norepo-sync) _p9k_vcs_status_purge $dir;;
@@ -3151,7 +3162,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
@@ -3432,6 +3443,8 @@ function _p9k_set_iface() {
function _p9k_build_segment() {
_p9k_segment_name=${_p9k_segment_name%_joined}
+ local disabled=_POWERLEVEL9K_${(U)_p9k_segment_name}_DISABLED_DIR_PATTERN
+ [[ $_p9k_pwd == ${(P)~disabled} ]] && return
if [[ $_p9k_segment_name == custom_* ]]; then
_p9k_custom_prompt $_p9k_segment_name[8,-1]
elif (( $+functions[prompt_$_p9k_segment_name] )); then
@@ -3442,6 +3455,8 @@ function _p9k_build_segment() {
function _p9k_build_instant_segment() {
_p9k_segment_name=${_p9k_segment_name%_joined}
+ local disabled=_POWERLEVEL9K_${(U)_p9k_segment_name}_DISABLED_DIR_PATTERN
+ [[ $_p9k_pwd == ${(P)~disabled} ]] && return
if (( $+functions[instant_prompt_$_p9k_segment_name] )); then
local -i len=$#_p9k__prompt
_p9k_non_hermetic_expansion=0
@@ -3458,43 +3473,45 @@ function _p9k_set_prompt() {
IFS=$' \t\n\0'
_p9k_pwd=${(%):-%/}
_p9k_pwd_a=${_p9k_pwd:A}
- PROMPT=$_p9k_prompt_prefix_left
+ PROMPT=
RPROMPT=
+ [[ $1 == instant_ ]] || PROMPT+='${$((_p9k_on_expand()))+}'
+ PROMPT+=$_p9k_prompt_prefix_left
(( _p9k_fetch_iface )) && _p9k_set_iface
- local -i left_idx=1 right_idx=1 num_lines=$#_p9k_line_segments_left i
- for i in {1..$num_lines}; do
+ local -i left_idx=1 right_idx=1 num_lines=$#_p9k_line_segments_left
+ for _p9k_line_index in {1..$num_lines}; do
local right=
if (( !_POWERLEVEL9K_DISABLE_RPROMPT )); then
_p9k_dir=
_p9k__prompt=
_p9k_segment_index=right_idx
_p9k_prompt_side=right
- for _p9k_segment_name in ${(@0)_p9k_line_segments_right[i]}; do
+ for _p9k_segment_name in ${(@0)_p9k_line_segments_right[_p9k_line_index]}; do
_p9k_build_${1}segment
done
_p9k__prompt=${${_p9k__prompt//$' %{\b'/'%{%G'}//$' \b'}
right_idx=_p9k_segment_index
- if [[ -n $_p9k__prompt || $_p9k_line_never_empty_right[i] == 1 ]]; then
- right=$_p9k_line_prefix_right[i]$_p9k__prompt$_p9k_line_suffix_right[i]
+ if [[ -n $_p9k__prompt || $_p9k_line_never_empty_right[_p9k_line_index] == 1 ]]; then
+ right=$_p9k_line_prefix_right[_p9k_line_index]$_p9k__prompt$_p9k_line_suffix_right[_p9k_line_index]
fi
fi
unset _p9k_dir
- _p9k__prompt=$_p9k_line_prefix_left[i]
+ _p9k__prompt=$_p9k_line_prefix_left[_p9k_line_index]
_p9k_segment_index=left_idx
_p9k_prompt_side=left
- for _p9k_segment_name in ${(@0)_p9k_line_segments_left[i]}; do
+ for _p9k_segment_name in ${(@0)_p9k_line_segments_left[_p9k_line_index]}; do
_p9k_build_${1}segment
done
_p9k__prompt=${${_p9k__prompt//$' %{\b'/'%{%G'}//$' \b'}
left_idx=_p9k_segment_index
- _p9k__prompt+=$_p9k_line_suffix_left[i]
- if (( $+_p9k_dir || (i != num_lines && $#right) )); then
- _p9k__prompt='${${:-${_p9k_d::=0}${_p9k_rprompt::=${__p9k_x_right-'$right'}}${_p9k_lprompt::='$_p9k__prompt'}}+}'
+ _p9k__prompt+=$_p9k_line_suffix_left[_p9k_line_index]
+ if (( $+_p9k_dir || (_p9k_line_index != num_lines && $#right) )); then
+ _p9k__prompt='${${:-${_p9k_d::=0}${_p9k_rprompt::='$right'}${_p9k_lprompt::='$_p9k__prompt'}}+}'
_p9k__prompt+=$_p9k_gap_pre
if (( $+_p9k_dir )); then
- if (( i == num_lines && (_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS > 0 || _POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT > 0) )); then
+ if (( _p9k_line_index == num_lines && (_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS > 0 || _POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT > 0) )); then
local a=$_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS
local f=$((0.01*_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT))'*_p9k_clm'
_p9k__prompt+="\${\${_p9k_g::=$((($a<$f)*$f+($a>=$f)*$a))}+}"
@@ -3519,15 +3536,15 @@ function _p9k_set_prompt() {
else
_p9k__prompt+='${_p9k_lprompt}'
fi
- ((i != num_lines && $#right)) && _p9k__prompt+=$_p9k_line_gap_post[i]
+ ((_p9k_line_index != num_lines && $#right)) && _p9k__prompt+=$_p9k_line_gap_post[_p9k_line_index]
fi
- if (( i == num_lines )); then
- [[ -n $right ]] && RPROMPT='${__p9k_x_right-'$_p9k_prompt_prefix_right$right$_p9k_prompt_suffix_right'}'
- _p9k__prompt+=$_p9k_prompt_suffix_left
+ if (( _p9k_line_index == num_lines )); then
+ [[ -n $right ]] && RPROMPT=$_p9k_prompt_prefix_right$right$_p9k_prompt_suffix_right
+ _p9k__prompt='${_p9k__'$_p9k_line_index'-'$_p9k__prompt'}'$_p9k_prompt_suffix_left
[[ $1 == instant_ ]] || PROMPT+=$_p9k__prompt
else
- PROMPT+=$_p9k__prompt
- [[ -n $right ]] || PROMPT+=$'\n'
+ [[ -n $right ]] || _p9k__prompt+=$'\n'
+ PROMPT+='${_p9k__'$_p9k_line_index'-'$_p9k__prompt'}'
fi
done
@@ -3546,7 +3563,7 @@ _p9k_set_instant_prompt() {
RPROMPT=$saved_rprompt
}
-typeset -gri __p9k_instant_prompt_version=10
+typeset -gri __p9k_instant_prompt_version=11
_p9k_dump_instant_prompt() {
local user=${(%):-%n}
@@ -3563,6 +3580,11 @@ _p9k_dump_instant_prompt() {
sysopen -a -o creat,trunc -u fd $tmp || return
{
[[ $TERM_PROGRAM == Hyper ]] && local hyper='==' || local hyper='!='
+ local -a display_v=("${_p9k__display_v[@]}")
+ local -i i
+ for ((i = 6; i <= $#display_v; i+=2)); do display_v[i]=show; done
+ display_v[2]=hide
+ display_v[4]=hide
>&$fd print -r -- "() {
emulate -L zsh
(( ! \$+__p9k_instant_prompt_disabled )) || return
@@ -3592,9 +3614,70 @@ _p9k_dump_instant_prompt() {
{ content="$(<$prompt_file)" } 2>/dev/null || return
local tail=${content##*$rs$key$us}
[[ ${#tail} != ${#content} ]] || return
+ local P9K_PROMPT=instant
+ if (( ! $+P9K_TTY )); then'
+ if (( _POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS < 0 )); then
+ >&$fd print -r -- ' typeset -gx P9K_TTY=new'
+ else
+ >&$fd print -r -- '
+ typeset -gx P9K_TTY=old
+ zmodload -F zsh/stat b:zstat
+ zmodload zsh/datetime
+ local -a stat
+ if zstat -A stat +ctime -- $TTY 2>/dev/null &&
+ (( EPOCHREALTIME - stat[1] < '$_POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS' )); then
+ P9K_TTY=new
+ fi'
+ fi
+ >&$fd print -r -- ' fi
+ local -i _p9k__empty_line_i=3 _p9k__ruler_i=3
+ local -A _p9k__display_k=('${(j: :)${(@q)${(kv)_p9k__display_k}}}')
+ local -a _p9k__display_v=('${(j: :)${(@q)display_v}}')
+ function p10k() {
+ emulate -L zsh
+ setopt no_hist_expand extended_glob prompt_percent prompt_subst no_aliases
+ [[ $1 == display ]] || return
+ shift
+ local opt match MATCH prev new pair list name var
+ local -i k
+ for opt; do
+ pair=(${(s:=:)opt})
+ list=(${(s:,:)${pair[2]}})
+ for k in ${(u@)_p9k__display_k[(I)$pair[1]]:/(#m)*/$_p9k__display_k[$MATCH]}; do
+ if (( $#list == 1 )); then
+ [[ $_p9k__display_v[k+1] == $list[1] ]] && continue
+ new=$list[1]
+ else
+ new=${list[list[(I)$_p9k__display_v[k+1]]+1]:-$list[1]}
+ [[ $_p9k__display_v[k+1] == $new ]] && continue
+ fi
+ _p9k__display_v[k+1]=$new
+ name=$_p9k__display_v[k]
+ if [[ $name == (empty_line|ruler) ]]; then
+ var=_p9k__${name}_i
+ [[ $new == hide ]] && typeset -gi $var=3 || unset $var
+ elif [[ $name == (#b)(<->)(*) ]]; then
+ var=_p9k__${match[1]}${${${${match[2]//\/}/#left/l}/#right/r}/#gap/g}
+ [[ $new == hide ]] && typeset -g $var= || unset $var
+ fi
+ done
+ done
+ }'
+ if (( _POWERLEVEL9K_PROMPT_ADD_NEWLINE )); then
+ >&$fd print -r -- ' [[ $P9K_TTY == old ]] && { unset _p9k__empty_line_i; _p9k__display_v[2]=print }'
+ fi
+ if (( _POWERLEVEL9K_SHOW_RULER )); then
+ >&$fd print -r -- '[[ $P9K_TTY == old ]] && { unset _p9k__ruler_i; _p9k__display_v[4]=print }'
+ fi
+ if (( $+functions[p10k-on-pre-prompt] )); then
+ >&$fd print -r -- '
+ p10k-on-pre-prompt() { '$functions[p10k-on-pre-prompt]' }
+ p10k-on-pre-prompt
+ unfunction p10k-on-pre-prompt'
+ fi
+ >&$fd print -r -- '
+ trap "unset -m _p9k__\*; unfunction p10k" EXIT
local -a _p9k_t=("${(@ps:$us:)${tail%%$rs*}}")'
- (( __p9k_ksh_arrays )) && >&$fd print -r -- ' setopt ksh_arrays'
- (( __p9k_sh_glob )) && >&$fd print -r -- ' setopt sh_glob'
if [[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]]; then
if [[ $TERM_PROGRAM == Hyper ]]; then
local bad_lines=40 bad_columns=100
@@ -3606,15 +3689,14 @@ _p9k_dump_instant_prompt() {
zmodload -F zsh/stat b:zstat
zmodload zsh/datetime
local -a tty_ctime
- if ! zstat -A tty_ctime +ctime -- $TTY 2>/dev/null || (( $tty_ctime[1] + 2 > EPOCHREALTIME )); then
+ if ! zstat -A tty_ctime +ctime -- $TTY 2>/dev/null || (( tty_ctime[1] + 2 > EPOCHREALTIME )); then
zmodload zsh/datetime
local -F deadline=$((EPOCHREALTIME+0.025))
local tty_size
while true; do
if (( EPOCHREALTIME > deadline )) || ! tty_size="$(/bin/stty size 2>/dev/null)" || [[ $tty_size != <->" "<-> ]]; then
- local __p9k_x_ruler=
- local __p9k_x_gap=
- local __p9k_x_right=
+ (( $+_p9k__ruler_i )) || local -i _p9k__ruler_i=1
+ local _p9k__g= _p9k__'$#_p9k_line_segments_right'r= _p9k__'$#_p9k_line_segments_right'r_frame=
break
fi
if [[ $tty_size != "'$bad_lines' '$bad_columns'" ]]; then
@@ -3627,11 +3709,13 @@ _p9k_dump_instant_prompt() {
fi
fi'
fi
+ (( __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 -- '
- : ${__p9k_used_instant_prompt[1]//$lf/$((++height))}
+ (( height += ${#${__p9k_used_instant_prompt[1]//[^$lf]}} ))
local _p9k_ret
function _p9k_prompt_length() {
local COLUMNS=1024
@@ -3650,7 +3734,7 @@ _p9k_dump_instant_prompt() {
_p9k_ret=$x
}
local out'
- [[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]] && >&$fd print -r -- ' if (( ! $+__p9k_x_gap )); then'
+ [[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]] && >&$fd print -r -- ' if (( ! $+_p9k__g )); then'
>&$fd print -r -- '
[[ $PROMPT_EOL_MARK == "%B%S%#%s%b" ]] && _p9k_ret=1 || _p9k_prompt_length $PROMPT_EOL_MARK
local -i fill=$((COLUMNS > _p9k_ret ? COLUMNS - _p9k_ret : 0))
@@ -3834,113 +3918,238 @@ function _p9k_restore_state() {
}
function _p9k_clear_instant_prompt() {
- (( $+__p9k_instant_prompt_active )) || return 0
+ if (( $+__p9k_fd_0 )); then
+ exec 0<&$__p9k_fd_0 {__p9k_fd_0}>&-
+ unset __p9k_fd_0
+ fi
+ exec 1>&$__p9k_fd_1 2>&$__p9k_fd_2 {__p9k_fd_1}>&- {__p9k_fd_2}>&-
+ unset __p9k_fd_1 __p9k_fd_2
+ if [[ -s $__p9k_instant_prompt_output ]]; then
+ {
+ if [[ $POWERLEVEL9K_DEBUG_ISSUE_315 == true ]]; then
+ exec 2>&1
+ fi
+ local content
+ [[ $_POWERLEVEL9K_INSTANT_PROMPT == verbose ]] && content="$(<$__p9k_instant_prompt_output)"
+ local mark="${PROMPT_EOL_MARK-%B%S%#%s%b}"
+ _p9k_prompt_length $mark
+ local -i fill=$((COLUMNS > _p9k_ret ? COLUMNS - _p9k_ret : 0))
+ local sp="${(%):-%b%k%f%s%u$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}"
+ print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
+ if [[ -n ${(S)content//$'\e'*$'\a'} ]]; then
+ echo -E - ""
+ echo -E - "${(%):-[%3FWARNING%f]: Console output during zsh initialization detected.}"
+ echo -E - ""
+ echo -E - "${(%):-When using Powerlevel10k with instant prompt, console output during zsh}"
+ echo -E - "${(%):-initialization may indicate issues.}"
+ echo -E - ""
+ echo -E - "${(%):-You can:}"
+ echo -E - ""
+ echo -E - "${(%):- - %BRecommended%b: Change %B$__p9k_zshrc_u%b so that it does not perform console I/O}"
+ echo -E - "${(%):- after the instant prompt preamble. See the link below for details.}"
+ echo -E - ""
+ echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
+ echo -E - "${(%):- * Zsh will start %Bquickly%b and prompt will update %Bsmoothly%b.}"
+ echo -E - ""
+ echo -E - "${(%):- - Suppress this warning either by running %Bp10k configure%b or by manually}"
+ echo -E - "${(%):- defining the following parameter:}"
+ echo -E - ""
+ echo -E - "${(%):- %3Ftypeset%f -g POWERLEVEL9K_INSTANT_PROMPT=quiet}"
+ echo -E - ""
+ echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
+ echo -E - "${(%):- * Zsh will start %Bquickly%b but prompt will %Bjump down%b after initialization.}"
+ echo -E - ""
+ echo -E - "${(%):- - Disable instant prompt either by running %Bp10k configure%b or by manually}"
+ echo -E - "${(%):- defining the following parameter:}"
+ echo -E - ""
+ echo -E - "${(%):- %3Ftypeset%f -g POWERLEVEL9K_INSTANT_PROMPT=off}"
+ echo -E - ""
+ echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
+ echo -E - "${(%):- * Zsh will start %Bslowly%b.}"
+ echo -E - ""
+ echo -E - "${(%):- - Do nothing.}"
+ echo -E - ""
+ echo -E - "${(%):- * You %Bwill%b see this error message every time you start zsh.}"
+ echo -E - "${(%):- * Zsh will start %Bquickly%b but prompt will %Bjump down%b after initialization.}"
+ echo -E - ""
+ echo -E - "${(%):-For details, see:}"
+ echo - "${(%):-\e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\ahttps://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\e]8;;\a}"
+ echo -E - ""
+ echo - "${(%):-%3F-- console output produced during zsh initialization follows --%f}"
+ echo -E - ""
+ fi
+ cat $__p9k_instant_prompt_output
+ echo -nE - $sp
+ if [[ $POWERLEVEL9K_DEBUG_ISSUE_315 == true && -n ${(S)content//$'\e'*$'\a'} ]]; then
+ typeset content
+ ls -l $__p9k_instant_prompt_output
+ (( $+commands[hexdump] )) && hexdump -c $__p9k_instant_prompt_output
+ fi
+ zf_rm -f -- $__p9k_instant_prompt_output
+ } 2>/dev/null
+ else
+ zf_rm -f -- $__p9k_instant_prompt_output 2>/dev/null
+ print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
+ fi
+ prompt_opts=(percent subst sp cr)
+ if [[ $_POWERLEVEL9K_DISABLE_INSTANT_PROMPT == 0 && -o prompt_cr ]]; then
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):-[%1FERROR%f]: When using Powerlevel10k with instant prompt, %Bprompt_cr%b must be unset.}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):-You can:}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- - %BRecommended%b: call %Bp10k finalize%b at the end of %B$__p9k_zshrc_u%b.}"
+ >&2 echo -E - "${(%):- You can do this by running the following command:}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- %2Fecho%f %3F'(( ! \${+functions[p10k]\} )) || p10k finalize'%f >>! $__p9k_zshrc_u}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
+ >&2 echo -E - "${(%):- * Zsh will start %Bquickly%b and %Bwithout%b prompt flickering.}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- - Find where %Bprompt_cr%b option gets sets in your zsh configs and stop setting it.}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
+ >&2 echo -E - "${(%):- * Zsh will start %Bquickly%b and %Bwithout%b prompt flickering.}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- - Disable instant prompt either by running %Bp10k configure%b or by manually}"
+ >&2 echo -E - "${(%):- defining the following parameter:}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- %3Ftypeset%f -g POWERLEVEL9K_INSTANT_PROMPT=off}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
+ >&2 echo -E - "${(%):- * Zsh will start %Bslowly%b.}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- - Do nothing.}"
+ >&2 echo -E - ""
+ >&2 echo -E - "${(%):- * You %Bwill%b see this error message every time you start zsh.}"
+ >&2 echo -E - "${(%):- * Zsh will start %Bquckly%b but %Bwith%b prompt flickering.}"
+ >&2 echo -E - ""
+ fi
+}
+
+function _p9k_maybe_dump() {
+ (( __p9k_dumps_enabled )) || return 0
+
+ _p9k__instant_prompt_sig=$_p9k_pwd:$P9K_SSH:${(%):-%#}
+
+ if (( ! _p9k__dump_pid )) || ! kill -0 $_p9k__dump_pid 2>/dev/null; then
+ _p9k__dump_pid=0
+ if (( _p9k__prompt_idx == 1 )) then
+ (( _p9k__instant_prompt_disabled )) || _p9k_set_instant_prompt
+ if (( !_p9k_state_restored )); then
+ if (( !_p9k__instant_prompt_disabled )); then
+ _p9k_dump_instant_prompt
+ _p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]=1
+ fi
+ _p9k_dump_state
+ _p9k__state_dump_scheduled=0
+ elif [[ $_p9k__instant_prompt_disabled == 0 &&
+ "${(pj:\x1f:)__p9k_used_instant_prompt}" != "${(e)_p9k_instant_prompt}" ]]; then
+ _p9k_dump_instant_prompt
+ if (( ! $+_p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig] )); then
+ _p9k_dump_state
+ _p9k__state_dump_scheduled=0
+ _p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]=1
+ fi
+ fi
+ 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
+ _p9k_set_instant_prompt
+ _p9k_dump_instant_prompt
+ _p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]=1
+ fi
+ _p9k_dump_state
+ ) &!
+ _p9k__dump_pid=$!
+ _p9k__state_dump_scheduled=0
+ (( _p9k__instant_prompt_disabled )) || _p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]=1
+ fi
+ fi
+}
+
+function _p9k_on_expand() {
+ (( _p9k__expanded && ! $+__p9k_instant_prompt_active )) && return
+
() {
emulate -L zsh
- if (( $+__p9k_fd_0 )); then
- exec 0<&$__p9k_fd_0 {__p9k_fd_0}>&-
- unset __p9k_fd_0
- fi
- exec 1>&$__p9k_fd_1 2>&$__p9k_fd_2 {__p9k_fd_1}>&- {__p9k_fd_2}>&-
- unset __p9k_fd_1 __p9k_fd_2 __p9k_instant_prompt_active
- if [[ -s $__p9k_instant_prompt_output ]]; then
- {
- local content
- [[ $_POWERLEVEL9K_INSTANT_PROMPT == verbose ]] && content="$(<$__p9k_instant_prompt_output)"
- local mark="${PROMPT_EOL_MARK-%B%S%#%s%b}"
- _p9k_prompt_length $mark
- local -i fill=$((COLUMNS > _p9k_ret ? COLUMNS - _p9k_ret : 0))
- local sp="${(%):-%b%k%f%s%u$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}"
- print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
- if [[ -n ${(S)content//$'\e'*$'\a'} ]]; then
- echo -E - ""
- echo -E - "${(%):-[%3FWARNING%f]: Console output during zsh initialization detected.}"
- echo -E - ""
- echo -E - "${(%):-When using Powerlevel10k with instant prompt, console output during zsh}"
- echo -E - "${(%):-initialization may indicate issues.}"
- echo -E - ""
- echo -E - "${(%):-You can:}"
- echo -E - ""
- echo -E - "${(%):- - %BRecommended%b: Change %B$__p9k_zshrc_u%b so that it does not perform console I/O}"
- echo -E - "${(%):- after the instant prompt preamble. See the link below for details.}"
- echo -E - ""
- echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
- echo -E - "${(%):- * Zsh will start %Bquickly%b and prompt will update %Bsmoothly%b.}"
- echo -E - ""
- echo -E - "${(%):- - Suppress this warning either by running %Bp10k configure%b or by manually}"
- echo -E - "${(%):- defining the following parameter:}"
- echo -E - ""
- echo -E - "${(%):- %3Ftypeset%f -g POWERLEVEL9K_INSTANT_PROMPT=quiet}"
- echo -E - ""
- echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
- echo -E - "${(%):- * Zsh will start %Bquickly%b but prompt will %Bjump down%b after initialization.}"
- echo -E - ""
- echo -E - "${(%):- - Disable instant prompt either by running %Bp10k configure%b or by manually}"
- echo -E - "${(%):- defining the following parameter:}"
- echo -E - ""
- echo -E - "${(%):- %3Ftypeset%f -g POWERLEVEL9K_INSTANT_PROMPT=off}"
- echo -E - ""
- echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
- echo -E - "${(%):- * Zsh will start %Bslowly%b.}"
- echo -E - ""
- echo -E - "${(%):- - Do nothing.}"
- echo -E - ""
- echo -E - "${(%):- * You %Bwill%b see this error message every time you start zsh.}"
- echo -E - "${(%):- * Zsh will start %Bquickly%b but prompt will %Bjump down%b after initialization.}"
- echo -E - ""
- echo -E - "${(%):-For details, see:}"
- echo - "${(%):-\e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\ahttps://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\e]8;;\a}"
- echo -E - ""
- echo - "${(%):-%3F-- console output produced during zsh initialization follows --%f}"
- echo -E - ""
+ setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
+
+ _p9k_maybe_dump
+ (( $+__p9k_instant_prompt_active )) && _p9k_clear_instant_prompt
+
+ (( _p9k__expanded )) && return
+ _p9k__expanded=1
+
+ if (( ! $+P9K_TTY )); then
+ typeset -gx P9K_TTY=old
+ if (( _POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS < 0 )); then
+ P9K_TTY=new
+ else
+ local -a stat
+ if zstat -A stat +ctime -- $TTY 2>/dev/null &&
+ (( EPOCHREALTIME - stat[1] < _POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS )); then
+ P9K_TTY=new
fi
- cat $__p9k_instant_prompt_output
- echo -nE - $sp
- zf_rm -f -- $__p9k_instant_prompt_output
- } 2>/dev/null
- else
- zf_rm -f -- $__p9k_instant_prompt_output 2>/dev/null
- print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
+ fi
fi
- prompt_opts=(percent subst sp cr)
- if [[ $_POWERLEVEL9K_DISABLE_INSTANT_PROMPT == 0 && -o prompt_cr ]]; then
- >&2 echo -E - ""
- >&2 echo -E - "${(%):-[%1FERROR%f]: When using Powerlevel10k with instant prompt, %Bprompt_cr%b must be unset.}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):-You can:}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- - %BRecommended%b: call %Bp10k finalize%b at the end of %B$__p9k_zshrc_u%b.}"
- >&2 echo -E - "${(%):- You can do this by running the following command:}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- %2Fecho%f %3F'(( ! \${+functions[p10k]\} )) || p10k finalize'%f >>! $__p9k_zshrc_u}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
- >&2 echo -E - "${(%):- * Zsh will start %Bquickly%b and %Bwithout%b prompt flickering.}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- - Find where %Bprompt_cr%b option gets sets in your zsh configs and stop setting it.}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
- >&2 echo -E - "${(%):- * Zsh will start %Bquickly%b and %Bwithout%b prompt flickering.}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- - Disable instant prompt either by running %Bp10k configure%b or by manually}"
- >&2 echo -E - "${(%):- defining the following parameter:}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- %3Ftypeset%f -g POWERLEVEL9K_INSTANT_PROMPT=off}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- * You %Bwill not%b see this error message again.}"
- >&2 echo -E - "${(%):- * Zsh will start %Bslowly%b.}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- - Do nothing.}"
- >&2 echo -E - ""
- >&2 echo -E - "${(%):- * You %Bwill%b see this error message every time you start zsh.}"
- >&2 echo -E - "${(%):- * Zsh will start %Bquckly%b but %Bwith%b prompt flickering.}"
- >&2 echo -E - ""
+
+ __p9k_reset_state=1
+
+ if (( _POWERLEVEL9K_PROMPT_ADD_NEWLINE )); then
+ if [[ $P9K_TTY == new ]]; then
+ _p9k__empty_line_i=3
+ _p9k__display_v[2]=hide
+ elif [[ -z $_p9k_transient_prompt ]]; then
+ _p9k__empty_line_i=3
+ _p9k__display_v[2]=print
+ else
+ unset _p9k__empty_line_i
+ _p9k__display_v[2]=show
+ fi
+ fi
+
+ if (( _POWERLEVEL9K_SHOW_RULER )); then
+ if [[ $P9K_TTY == new ]]; then
+ _p9k__ruler_i=3
+ _p9k__display_v[4]=hide
+ elif [[ -z $_p9k_transient_prompt ]]; then
+ _p9k__ruler_i=3
+ _p9k__display_v[4]=print
+ else
+ unset _p9k__ruler_i
+ _p9k__display_v[4]=show
+ fi
+ fi
+
+ typeset -g P9K_PROMPT=regular
+
+ if (( $+functions[p10k-on-pre-prompt] )); then
+ p10k-on-pre-prompt
+ fi
+
+ __p9k_reset_state=0
+ P9K_TTY=old
+
+ [[ $_p9k__display_v[2] == print ]] && print -rn -- $_p9k_t[_p9k_empty_line_idx]
+ if [[ $_p9k__display_v[4] == print ]]; then
+ local ruler=$_p9k_t[_p9k_ruler_idx]
+ () {
+ (( __p9k_ksh_arrays )) && setopt ksh_arrays
+ (( __p9k_sh_glob )) && setopt sh_glob
+ print -rP -- $ruler
+ }
fi
}
- unsetopt localoptions
- setopt prompt_sp prompt_cr
+ if (( $+__p9k_instant_prompt_active )); then
+ unset __p9k_instant_prompt_active
+ unsetopt localoptions
+ setopt prompt_sp prompt_cr
+ fi
}
+functions -M _p9k_on_expand
_p9k_precmd_impl() {
emulate -L zsh
@@ -3952,13 +4161,9 @@ _p9k_precmd_impl() {
if zle; then
__p9k_new_status=0
__p9k_new_pipestatus=(0)
+ _p9k__expanded=1
else
- print -rn "${_p9k_prompt_newline:-}"
- fi
-
- if (( _p9k__transient_rprompt_active )); then
- _p9k__transient_rprompt_active=0
- unset __p9k_x_right __p9k_x_gap
+ _p9k__expanded=0
fi
if (( $+_p9k_real_zle_rprompt_indent )); then
@@ -3989,7 +4194,7 @@ _p9k_precmd_impl() {
instant_prompt_disabled=1
else
source "$__p9k_cfg_path"
- _p9k_must_init
+ _POWERLEVEL9K_DISABLE_HOT_RELOAD=0 _p9k_must_init
fi
;;
2)
@@ -4028,50 +4233,13 @@ _p9k_precmd_impl() {
if [[ $precmd_functions[-1] != _p9k_precmd && $precmd_functions[(I)_p9k_precmd] != 0 ]]; then
precmd_functions=(${(@)precmd_functions:#_p9k_precmd} _p9k_precmd)
fi
+}
- if (( $+__p9k_instant_prompt_active )); then
- functions -M _p9k_clear_instant_prompt
- PROMPT+='${$((_p9k_clear_instant_prompt()))+}'
- fi
-
- (( __p9k_dumps_enabled )) || return 0
-
- _p9k__instant_prompt_sig=$_p9k_pwd:$P9K_SSH:${(%):-%#}
-
- if (( ! _p9k__dump_pid )) || ! kill -0 $_p9k__dump_pid 2>/dev/null; then
- _p9k__dump_pid=0
- if (( _p9k__prompt_idx == 1 )) then
- (( _p9k__instant_prompt_disabled )) || _p9k_set_instant_prompt
- if (( !_p9k_state_restored )); then
- if (( !_p9k__instant_prompt_disabled )); then
- _p9k_dump_instant_prompt
- _p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]=1
- fi
- _p9k_dump_state
- _p9k__state_dump_scheduled=0
- elif [[ $_p9k__instant_prompt_disabled == 0 &&
- "${(pj:\x1f:)__p9k_used_instant_prompt}" != "${(e)_p9k_instant_prompt}" ]]; then
- _p9k_dump_instant_prompt
- if (( ! $+_p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig] )); then
- _p9k_dump_state
- _p9k__state_dump_scheduled=0
- _p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]=1
- fi
- fi
- 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
- _p9k_set_instant_prompt
- _p9k_dump_instant_prompt
- _p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]=1
- fi
- _p9k_dump_state
- ) &!
- _p9k__dump_pid=$!
- _p9k__state_dump_scheduled=0
- (( _p9k__instant_prompt_disabled )) || _p9k_dumped_instant_prompt_sigs[$_p9k__instant_prompt_sig]=1
- fi
+_p9k_trapint() {
+ if (( __p9k_enabled )); then
+ emulate -L zsh
+ setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
+ _p9k_zle_line_finish
fi
}
@@ -4081,16 +4249,23 @@ _p9k_precmd() {
[[ -o ksh_arrays ]] && __p9k_ksh_arrays=1 || __p9k_ksh_arrays=0
[[ -o sh_glob ]] && __p9k_sh_glob=1 || __p9k_sh_glob=0
+ _p9k_precmd_impl
+
unsetopt localoptions
setopt nopromptbang prompt_percent prompt_subst
- _p9k_precmd_impl
+ if (( ! $+functions[TRAPINT] )); then
+ trap '_p9k_trapint; return 130' INT
+ fi
}
function _p9k_reset_prompt() {
- (( __p9k_ksh_arrays )) && setopt ksh_arrays
- (( __p9k_sh_glob )) && setopt sh_glob
- zle && zle .reset-prompt && zle -R
+ if zle && [[ -z $_p9k__line_finished ]]; then
+ (( __p9k_ksh_arrays )) && setopt ksh_arrays
+ (( __p9k_sh_glob )) && setopt sh_glob
+ zle .reset-prompt
+ zle -R
+ fi
}
function _p9k_zle_keymap_select() {
@@ -4133,7 +4308,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
@@ -4325,6 +4500,7 @@ _p9k_init_vars() {
typeset -g _p9k_prompt_side
typeset -g _p9k_segment_name
typeset -gi _p9k_segment_index
+ typeset -gi _p9k_line_index
typeset -g _p9k_refresh_reason
typeset -gi _p9k__region_active
typeset -g _p9k__async_pump_line
@@ -4353,7 +4529,10 @@ _p9k_init_vars() {
typeset -gi _p9k_g
typeset -gi _p9k_ind
typeset -g _p9k_gap_pre
- typeset -g _p9k_prompt_newline
+ typeset -gi _p9k__ruler_i=3
+ typeset -gi _p9k_ruler_idx
+ typeset -gi _p9k__empty_line_i=3
+ typeset -gi _p9k_empty_line_idx
typeset -g _p9k_prompt_prefix_left
typeset -g _p9k_prompt_prefix_right
typeset -g _p9k_prompt_suffix_left
@@ -4382,10 +4561,14 @@ _p9k_init_vars() {
typeset -g _p9k_uname
typeset -g _p9k_uname_o
typeset -g _p9k_uname_m
+ typeset -g _p9k_transient_prompt
+ typeset -g _p9k__last_prompt_pwd
+ typeset -gA _p9k__display_k
+ typeset -ga _p9k__display_v
- typeset -gi _p9k__transient_rprompt_active
typeset -gA _p9k__dotnet_stat_cache
typeset -gA _p9k__dir_stat_cache
+ typeset -gi _p9k__expanded
typeset -g P9K_VISUAL_IDENTIFIER
typeset -g P9K_CONTENT
@@ -4407,7 +4590,12 @@ _p9k_init_params() {
fi
fi
- _p9k_declare -i POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES 3
+ _p9k_declare -s POWERLEVEL9K_TRANSIENT_PROMPT off
+ [[ $_POWERLEVEL9K_TRANSIENT_PROMPT == (off|always|same-dir) ]] || _POWERLEVEL9K_TRANSIENT_PROMPT=off
+
+ _p9k_declare -b POWERLEVEL9K_DISABLE_HOT_RELOAD 0
+ _p9k_declare -F POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS 5
+ _p9k_declare -i POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES 1
_p9k_declare -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS -- context dir vcs
_p9k_declare -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS -- status root_indicator background_jobs history time
_p9k_declare -b POWERLEVEL9K_DISABLE_RPROMPT 0
@@ -4418,6 +4606,7 @@ _p9k_init_params() {
_p9k_declare -i POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT 1
_p9k_declare -s POWERLEVEL9K_COLOR_SCHEME dark
_p9k_declare -s POWERLEVEL9K_GITSTATUS_DIR ""
+ _p9k_declare -s POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN
_p9k_declare -b POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY 0
_p9k_declare -i POWERLEVEL9K_VCS_SHORTEN_LENGTH
_p9k_declare -i POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH
@@ -4670,6 +4859,12 @@ _p9k_init_params() {
(( ++i ))
fi
done
+
+ local var=
+ for var in ${parameters[(I)POWERLEVEL9K_*]}; do
+ local _var=_$var
+ (( $+parameters[$_var] )) || typeset -g $_var=${(P)var}
+ done
}
typeset -ga __p9k_wrapped_zle_widgets
@@ -4686,32 +4881,51 @@ _p9k_wrap_zle_widget() {
zle -N $orig ${widgets[$widget]#user:}
;;
builtin)
- eval "_p9k_orig_${(q)widget}() { zle .${(q)widget} }"
+ functions[_p9k_orig_$widget]="zle .${(q)widget}"
zle -N $orig _p9k_orig_$widget
;;
esac
local wrapper=_p9k_wrapper_$widget_$hook
- eval "function ${(q)wrapper}() {
+ functions[$wrapper]="
emulate -L zsh
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
(( __p9k_enabled )) && ${(q)hook} \"\$@\"
- (( \$+widgets[${(q)orig}] )) && zle ${(q)orig} -- \"\$@\"
- }"
+ (( \$+widgets[${(q)orig}] )) && zle ${(q)orig} -- \"\$@\""
zle -N -- $widget $wrapper
}
function _p9k_zle_line_finish() {
+ (( $+_p9k__line_finished )) && return
+
_p9k__line_finished=
- if [[ -o transient_rprompt ]]; then
- __p9k_x_right=
- __p9k_x_gap=
- _p9k__transient_rprompt_active=1
- _p9k_reset_prompt
- elif (( _p9k_reset_on_line_finish )); then
+ local -i reset=_p9k_reset_on_line_finish
+
+ if (( $+functions[p10k-on-post-prompt] )); then
+ __p9k_reset_state=1
+ p10k-on-post-prompt
+ if (( __p9k_reset_state == 2 )); then
+ reset=1
+ fi
+ __p9k_reset_state=0
+ fi
+
+ if [[ -n $_p9k_transient_prompt ]]; then
+ if [[ $_POWERLEVEL9K_TRANSIENT_PROMPT == always || $_p9k_pwd == $_p9k__last_prompt_pwd ]]; then
+ RPROMPT=
+ PROMPT=$_p9k_transient_prompt
+ reset=1
+ else
+ _p9k__last_prompt_pwd=$_p9k_pwd
+ fi
+ fi
+
+ if (( reset )); then
_p9k_reset_prompt
fi
+
+ _p9k__line_finished='%{%}'
}
function _p9k_zle_line_pre_redraw() {
@@ -4725,36 +4939,39 @@ function _p9k_zle_line_pre_redraw() {
prompt__p9k_internal_nothing() { _p9k__prompt+='${_p9k_sss::=}'; }
instant_prompt__p9k_internal_nothing() { prompt__p9k_internal_nothing; }
-# _p9k_build_gap_post <first|newline>
+# _p9k_build_gap_post line_number
_p9k_build_gap_post() {
- _p9k_get_icon '' MULTILINE_${(U)1}_PROMPT_GAP_CHAR
+ [[ $1 == 1 ]] && local kind=first || local kind=newline
+ _p9k_get_icon '' MULTILINE_${(U)kind}_PROMPT_GAP_CHAR
local char=${_p9k_ret:- }
_p9k_prompt_length $char
if (( _p9k_ret != 1 || $#char != 1 )); then
- print -rP -- "%F{red}WARNING!%f %BMULTILINE_${(U)1}_PROMPT_GAP_CHAR%b is not one character long. Will use ' '."
- print -rP -- "Either change the value of %BPOWERLEVEL9K_MULTILINE_${(U)1}_PROMPT_GAP_CHAR%b or remove it."
+ print -rP -- "%F{red}WARNING!%f %BMULTILINE_${(U)kind}_PROMPT_GAP_CHAR%b is not one character long. Will use ' '."
+ print -rP -- "Either change the value of %BPOWERLEVEL9K_MULTILINE_${(U)kind}_PROMPT_GAP_CHAR%b or remove it."
char=' '
fi
local style
- _p9k_color prompt_multiline_$1_prompt_gap BACKGROUND ""
+ _p9k_color prompt_multiline_${kind}_prompt_gap BACKGROUND ""
[[ -n $_p9k_ret ]] && _p9k_background $_p9k_ret
style+=$_p9k_ret
- _p9k_color prompt_multiline_$1_prompt_gap FOREGROUND ""
+ _p9k_color prompt_multiline_${kind}_prompt_gap FOREGROUND ""
[[ -n $_p9k_ret ]] && _p9k_foreground $_p9k_ret
style+=$_p9k_ret
_p9k_escape_style $style
style=$_p9k_ret
- local exp=POWERLEVEL9K_MULTILINE_${(U)1}_PROMPT_GAP_EXPANSION
+ local exp=_POWERLEVEL9K_MULTILINE_${(U)kind}_PROMPT_GAP_EXPANSION
(( $+parameters[$exp] )) && exp=${(P)exp} || exp='${P9K_GAP}'
[[ $char == '.' ]] && local s=',' || local s='.'
- _p9k_ret=$'${${__p9k_x_gap+\n}:-'$style'${${${_p9k_m:#-*}:+'
+ _p9k_ret=$'${${_p9k__g+\n}:-'$style'${${${_p9k_m:#-*}:+'
+ _p9k_ret+='${${_p9k__'$1'g+${(pl.$((_p9k_m+1)).. .)}}:-'
if [[ $exp == '${P9K_GAP}' ]]; then
- _p9k_ret+='${(pl'$s'$((_p9k_m+1))'$s$s$char$s$')}'
+ _p9k_ret+='${(pl'$s'$((_p9k_m+1))'$s$s$char$s')}'
else
- _p9k_ret+='${${P9K_GAP::=${(pl'$s'$((_p9k_m+1))'$s$s$char$s$')}}+}'
+ _p9k_ret+='${${P9K_GAP::=${(pl'$s'$((_p9k_m+1))'$s$s$char$s')}}+}'
_p9k_ret+='${:-"'$exp'"}'
style=1
fi
+ _p9k_ret+='}'
if (( __p9k_ksh_arrays )); then
_p9k_ret+=$'$_p9k_rprompt${_p9k_t[$((!_p9k_ind))]}}:-\n}'
else
@@ -4787,7 +5004,8 @@ _p9k_init_lines() {
local -i num_lines=num_left_lines
fi
- repeat $num_lines; do
+ local -i i
+ for i in {1..$num_lines}; do
local -i left_end=${left_segments[(i)newline]}
local -i right_end=${right_segments[(i)newline]}
_p9k_line_segments_left+="${(pj:\0:)left_segments[1,left_end-1]}"
@@ -4798,13 +5016,13 @@ _p9k_init_lines() {
_p9k_get_icon '' LEFT_SEGMENT_SEPARATOR
_p9k_get_icon 'prompt_empty_line' LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL $_p9k_ret
_p9k_escape $_p9k_ret
- _p9k_line_prefix_left+='${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::=%f'$_p9k_ret'}}+}'
+ _p9k_line_prefix_left+='${_p9k__'$i'l-${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::=%f'$_p9k_ret'}}+}'
_p9k_line_suffix_left+='%b%k$_p9k_sss%b%k%f'
- _p9k_escape ${(g::)POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL}
+ _p9k_escape ${(g::)_POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL}
[[ -n $_p9k_ret ]] && _p9k_line_never_empty_right+=1 || _p9k_line_never_empty_right+=0
- _p9k_line_prefix_right+='${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::='$_p9k_ret'}}+}'
- _p9k_line_suffix_right+='$_p9k_sss%b%k%f' # gets overridden for _p9k_emulate_zero_rprompt_indent
+ _p9k_line_prefix_right+='${_p9k__'$i'r-${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::='$_p9k_ret'}}+}'
+ _p9k_line_suffix_right+='$_p9k_sss%b%k%f}' # gets overridden for _p9k_emulate_zero_rprompt_indent
done
_p9k_get_icon '' LEFT_SEGMENT_END_SEPARATOR
@@ -4819,59 +5037,66 @@ _p9k_init_lines() {
fi
fi
+ for i in {1..$num_lines}; do _p9k_line_suffix_left[i]+='}'; done
+
if (( num_lines > 1 )); then
- _p9k_build_gap_post first
- _p9k_line_gap_post[1]=$_p9k_ret
+ for i in {1..$((num_lines-1))}; do
+ _p9k_build_gap_post $i
+ _p9k_line_gap_post+=$_p9k_ret
+ done
- if [[ $+POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
+ if [[ $+_POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
_p9k_get_icon '' MULTILINE_FIRST_PROMPT_PREFIX
- [[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
- # Not escaped for historical reasons.
- _p9k_ret='${:-"'$_p9k_ret'"}'
- _p9k_line_prefix_left[1]=$_p9k_ret$_p9k_line_prefix_left[1]
+ if [[ -n $_p9k_ret ]]; then
+ [[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
+ # Not escaped for historical reasons.
+ _p9k_ret='${_p9k__1l_frame-"'$_p9k_ret'"}'
+ _p9k_line_prefix_left[1]=$_p9k_ret$_p9k_line_prefix_left[1]
+ fi
fi
- if [[ $+POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
+ if [[ $+_POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
_p9k_get_icon '' MULTILINE_LAST_PROMPT_PREFIX
- [[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
- # Not escaped for historical reasons.
- _p9k_ret='${:-"'$_p9k_ret'"}'
- _p9k_line_prefix_left[-1]=$_p9k_ret$_p9k_line_prefix_left[-1]
+ if [[ -n $_p9k_ret ]]; then
+ [[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
+ # Not escaped for historical reasons.
+ _p9k_ret='${_p9k__'$num_lines'l_frame-"'$_p9k_ret'"}'
+ _p9k_line_prefix_left[-1]=$_p9k_ret$_p9k_line_prefix_left[-1]
+ fi
fi
_p9k_get_icon '' MULTILINE_FIRST_PROMPT_SUFFIX
if [[ -n $_p9k_ret ]]; then
[[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
- _p9k_escape $_p9k_ret
- _p9k_line_suffix_right[1]+=$_p9k_ret
+ _p9k_line_suffix_right[1]+='${_p9k__1r_frame-'${(qqq)_p9k_ret}'}'
_p9k_line_never_empty_right[1]=1
fi
_p9k_get_icon '' MULTILINE_LAST_PROMPT_SUFFIX
if [[ -n $_p9k_ret ]]; then
[[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
- _p9k_escape $_p9k_ret
- _p9k_line_suffix_right[-1]+=$_p9k_ret
+ _p9k_line_suffix_right[-1]+='${_p9k__'$num_lines'r_frame-'${(qqq)_p9k_ret}'}'
_p9k_line_never_empty_right[-1]=1
fi
if (( num_lines > 2 )); then
- _p9k_build_gap_post newline
- _p9k_line_gap_post[2,-2]=(${${:-{3..num_lines}}:/*/$_p9k_ret})
-
- if [[ $+POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
+ if [[ $+_POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
_p9k_get_icon '' MULTILINE_NEWLINE_PROMPT_PREFIX
- [[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
- # Not escaped for historical reasons.
- _p9k_ret='${:-"'$_p9k_ret'"}'
- _p9k_line_prefix_left[2,-2]=$_p9k_ret${^_p9k_line_prefix_left[2,-2]}
+ if [[ -n $_p9k_ret ]]; then
+ [[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
+ for i in {2..$((num_lines-1))}; do
+ # Not escaped for historical reasons.
+ _p9k_line_prefix_left[i]='${_p9k__'$i'l_frame-"'$_p9k_ret'"}'$_p9k_line_prefix_left[i]
+ done
+ fi
fi
_p9k_get_icon '' MULTILINE_NEWLINE_PROMPT_SUFFIX
if [[ -n $_p9k_ret ]]; then
[[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
- _p9k_escape $_p9k_ret
- _p9k_line_suffix_right[2,-2]=${^_p9k_line_suffix_right[2,-2]}$_p9k_ret
+ for i in {2..$((num_lines-1))}; do
+ _p9k_line_suffix_right[i]+='${_p9k__'$i'r_frame-'${(qqq)_p9k_ret}'}'
+ done
_p9k_line_never_empty_right[2,-2]=${(@)_p9k_line_never_empty_right[2,-2]/0/1}
fi
fi
@@ -4885,9 +5110,41 @@ _p9k_all_params_eq() {
done
}
+_p9k_init_display() {
+ _p9k__display_k=(empty_line 1 ruler 3)
+ _p9k__display_v=(empty_line hide ruler hide)
+ local -i n=3 i
+ local name
+ for i in {1..$#_p9k_line_segments_left}; do
+ local -i j=$((-$#_p9k_line_segments_left+i-1))
+ _p9k__display_k+=(
+ $i $((n+=2)) $j $n
+ $i/left_frame $((n+=2)) $j/left_frame $n
+ $i/right_frame $((n+=2)) $j/right_frame $n
+ $i/left $((n+=2)) $j/left $n
+ $i/right $((n+=2)) $j/right $n
+ $i/gap $((n+=2)) $j/gap $n)
+ _p9k__display_v+=(
+ $i show
+ $i/left_frame show
+ $i/right_frame show
+ $i/left show
+ $i/right show
+ $i/gap show)
+ for name in ${(@0)_p9k_line_segments_left[i]}; do
+ _p9k__display_k+=($i/left/$name $((n+=2)) $j/left/$name $n)
+ _p9k__display_v+=($i/left/$name show)
+ done
+ for name in ${(@0)_p9k_line_segments_right[i]}; do
+ _p9k__display_k+=($i/right/$name $((n+=2)) $j/right/$name $n)
+ _p9k__display_v+=($i/right/$name show)
+ done
+ done
+}
+
_p9k_init_prompt() {
- _p9k_t=($'\n' '')
- _p9k_prompt_overflow_bug && _p9k_t[2]='%{%G%}'
+ _p9k_t=($'\n' $'%{\n%}' '')
+ _p9k_prompt_overflow_bug && _p9k_t[2]=$'%{%G\n%}'
_p9k_init_lines
@@ -4902,9 +5159,9 @@ _p9k_init_prompt() {
_p9k_gap_pre+='}+}'
_p9k_prompt_prefix_left='${${_p9k_clm::=$COLUMNS}+}${${COLUMNS::=1024}+}'
- _p9k_prompt_prefix_right='${${_p9k_clm::=$COLUMNS}+}${${COLUMNS::=1024}+}'
+ _p9k_prompt_prefix_right='${_p9k__'$#_p9k_line_segments_left'-${${_p9k_clm::=$COLUMNS}+}${${COLUMNS::=1024}+}'
_p9k_prompt_suffix_left='${${COLUMNS::=$_p9k_clm}+}'
- _p9k_prompt_suffix_right='${${COLUMNS::=$_p9k_clm}+}'
+ _p9k_prompt_suffix_right='${${COLUMNS::=$_p9k_clm}+}}'
if _p9k_segment_in_use vi_mode || _p9k_segment_in_use prompt_char; then
_p9k_prompt_prefix_left+='${${_p9k__keymap::=${KEYMAP:-$_p9k__keymap}}+}'
@@ -4920,55 +5177,58 @@ _p9k_init_prompt() {
# We can work around it as long as RPROMPT ends with a space.
if [[ -n $_p9k_line_segments_right[-1] && $_p9k_line_never_empty_right[-1] == 0 &&
$ZLE_RPROMPT_INDENT == 0 ]] &&
- _p9k_all_params_eq 'POWERLEVEL9K_*WHITESPACE_BETWEEN_RIGHT_SEGMENTS' ' ' &&
- _p9k_all_params_eq 'POWERLEVEL9K_*RIGHT_RIGHT_WHITESPACE' ' ' &&
- _p9k_all_params_eq 'POWERLEVEL9K_*RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL' '' &&
+ _p9k_all_params_eq '_POWERLEVEL9K_*WHITESPACE_BETWEEN_RIGHT_SEGMENTS' ' ' &&
+ _p9k_all_params_eq '_POWERLEVEL9K_*RIGHT_RIGHT_WHITESPACE' ' ' &&
+ _p9k_all_params_eq '_POWERLEVEL9K_*RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL' '' &&
! is-at-least 5.7.2; then
_p9k_emulate_zero_rprompt_indent=1
_p9k_prompt_prefix_left+='${${:-${_p9k_real_zle_rprompt_indent:=$ZLE_RPROMPT_INDENT}${ZLE_RPROMPT_INDENT::=1}${_p9k_ind::=0}}+}'
- _p9k_line_suffix_right[-1]='${_p9k_sss:+${_p9k_sss% }%E}'
+ _p9k_line_suffix_right[-1]='${_p9k_sss:+${_p9k_sss% }%E}}'
else
_p9k_emulate_zero_rprompt_indent=0
_p9k_prompt_prefix_left+='${${_p9k_ind::=${${ZLE_RPROMPT_INDENT:-1}/#-*/0}}+}'
fi
- if (( _POWERLEVEL9K_PROMPT_ADD_NEWLINE )); then
- repeat $_POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT _p9k_prompt_newline+=$'\n'
+ if (( _POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT > 0 )); then
+ _p9k_t+=${(pl.$_POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT..\n.)}
+ else
+ _p9k_t+=''
+ fi
+ _p9k_empty_line_idx=$#_p9k_t
+ if (( __p9k_ksh_arrays )); then
+ _p9k_prompt_prefix_left+='${_p9k_t[${_p9k__empty_line_i:-'$#_p9k_t'}-1]}'
+ else
+ _p9k_prompt_prefix_left+='${_p9k_t[${_p9k__empty_line_i:-'$#_p9k_t'}]}'
fi
- if (( _POWERLEVEL9K_SHOW_RULER )); then
- _p9k_get_icon '' RULER_CHAR
- local ruler_char=$_p9k_ret
- _p9k_prompt_length $ruler_char
- if (( _p9k_ret == 1 && $#ruler_char == 1 )); then
- _p9k_prompt_prefix_left+=$'${${__p9k_x_ruler+\n}:-'
- _p9k_color prompt_ruler BACKGROUND ""
- if [[ -z $_p9k_ret && $ruler_char == ' ' ]]; then
- _p9k_prompt_prefix_left+=$'\n'
- else
- _p9k_background $_p9k_ret
- _p9k_escape_style $_p9k_ret
- _p9k_prompt_prefix_left+=%b$_p9k_ret
- _p9k_color prompt_ruler FOREGROUND ""
- _p9k_foreground $_p9k_ret
- _p9k_escape_style $_p9k_ret
- _p9k_prompt_prefix_left+=$_p9k_ret
- [[ $ruler_char == '.' ]] && local sep=',' || local sep='.'
- local ruler_len='${$((_p9k_clm-_p9k_ind))/#-*/0}'
- _p9k_prompt_prefix_left+="\${(pl$sep$ruler_len$sep$sep${(q)ruler_char}$sep)}%k%f"
- if (( __p9k_ksh_arrays )); then
- _p9k_prompt_prefix_left+='${_p9k_t[$((!_p9k_ind))]}'
- else
- _p9k_prompt_prefix_left+='${_p9k_t[$((1+!_p9k_ind))]}'
- fi
- fi
- _p9k_prompt_prefix_left+='}'
+ _p9k_get_icon '' RULER_CHAR
+ local ruler_char=$_p9k_ret
+ _p9k_prompt_length $ruler_char
+ (( _p9k_ret == 1 && $#ruler_char == 1 )) || ruler_char=' '
+ _p9k_color prompt_ruler BACKGROUND ""
+ if [[ -z $_p9k_ret && $ruler_char == ' ' ]]; then
+ local ruler=$'\n'
+ else
+ _p9k_background $_p9k_ret
+ local ruler=%b$_p9k_ret
+ _p9k_color prompt_ruler FOREGROUND ""
+ _p9k_foreground $_p9k_ret
+ ruler+=$_p9k_ret
+ [[ $ruler_char == '.' ]] && local sep=',' || local sep='.'
+ ruler+='${(pl'$sep'${$((_p9k_clm-_p9k_ind))/#-*/0}'$sep$sep$ruler_char$sep')}%k%f'
+ if (( __p9k_ksh_arrays )); then
+ ruler+='${_p9k_t[$((!_p9k_ind))]}'
else
- print -rP -- "%F{red}WARNING!%f %BPOWERLEVEL9K_RULER_CHAR%b is not one character long. Ruler won't be rendered."
- print -rP -- "Either change the value of %BPOWERLEVEL9K_RULER_CHAR%b or set %BPOWERLEVEL9K_SHOW_RULER=false%b to"
- print -rP -- "disable ruler."
+ ruler+='${_p9k_t[$((1+!_p9k_ind))]}'
fi
fi
+ _p9k_t+=$ruler
+ _p9k_ruler_idx=$#_p9k_t
+ if (( __p9k_ksh_arrays )); then
+ _p9k_prompt_prefix_left+='${(e)_p9k_t[${_p9k__ruler_i:-'$#_p9k_t'}-1]}'
+ else
+ _p9k_prompt_prefix_left+='${(e)_p9k_t[${_p9k__ruler_i:-'$#_p9k_t'}]}'
+ fi
if [[ $ITERM_SHELL_INTEGRATION_INSTALLED == Yes ]]; then
_p9k_prompt_prefix_left+=$'%{\e]133;A\a%}'
@@ -4993,7 +5253,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.
@@ -5013,18 +5273,20 @@ _p9k_init_ssh() {
}
_p9k_must_init() {
+ (( _POWERLEVEL9K_DISABLE_HOT_RELOAD )) && return 1
local IFS sig
if [[ -n $_p9k__param_sig ]]; then
IFS=$'\2' sig="${(e)_p9k__param_pat}"
[[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit
fi
- _p9k__param_pat=$'v2\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
+ _p9k__param_pat=$'v4\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\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+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'
- _p9k__param_pat+=$'$__p9k_sh_glob\1${options[transient_rprompt]}\1$ITERM_SHELL_INTEGRATION_INSTALLED\1'
+ _p9k__param_pat+=$'$__p9k_sh_glob\1$ITERM_SHELL_INTEGRATION_INSTALLED\1'
_p9k__param_pat+=$'${PROMPT_EOL_MARK-%B%S%#%s%b}\1$LANG\1$LC_ALL\1$LC_CTYPE\1'
+ _p9k__param_pat+=$'$functions[p10k-on-pre-prompt]\1'
local MATCH
IFS=$'\1' _p9k__param_pat+="${(@)${(@o)parameters[(I)POWERLEVEL9K_*]}:/(#m)*/\${${(q)MATCH}-$IFS\}}"
IFS=$'\2' _p9k__param_sig="${(e)_p9k__param_pat}"
@@ -5042,6 +5304,16 @@ function _p9k_init_cacheable() {
_p9k_init_params
_p9k_init_prompt
+ if [[ $_POWERLEVEL9K_TRANSIENT_PROMPT != off ]]; then
+ _p9k_transient_prompt='%b%k%s%u%F{%(?.'
+ _p9k_color prompt_prompt_char_OK_VIINS FOREGROUND 76
+ _p9k_transient_prompt+=$_p9k_ret'.'
+ _p9k_color prompt_prompt_char_ERROR_VIINS FOREGROUND 196
+ _p9k_transient_prompt+=$_p9k_ret')}${${P9K_CONTENT::="❯"}+}'
+ _p9k_param prompt_prompt_char_OK_VIINS CONTENT_EXPANSION '${P9K_CONTENT}'
+ _p9k_transient_prompt+='${:-"'$_p9k_ret'"}%b%k%f%s%u '
+ fi
+
_p9k_uname="$(uname)"
[[ $_p9k_uname == Linux ]] && _p9k_uname_o="$(uname -o 2>/dev/null)"
_p9k_uname_m="$(uname -m)"
@@ -5183,11 +5455,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
@@ -5224,13 +5496,19 @@ _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}
if [[ -z $daemon ]]; then
daemon=$gitstatus_dir/bin/gitstatusd-
- [[ $_p9k_uname_o == Android ]] && daemon+=android || daemon+=${_p9k_uname:l}
+ if [[ $_p9k_uname_o == Android ]]; then
+ daemon+=android
+ elif [[ $_p9k_uname == (MINGW_64-10.0|MSYS_NT-10.0)* ]]; then
+ daemon+=msys_nt-10.0
+ else
+ daemon+=${_p9k_uname:l}
+ fi
daemon+=-${_p9k_uname_m:l}
fi
local -i threads=${GITSTATUS_NUM_THREADS:-0}
@@ -5268,6 +5546,8 @@ _p9k_init() {
_p9k_init_vars
_p9k_restore_state || _p9k_init_cacheable
+ _p9k_init_display
+
if _p9k_segment_in_use todo; then
local todo=$commands[todo.sh]
if [[ -n $todo ]]; then
@@ -5285,9 +5565,7 @@ _p9k_init() {
fi
fi
- if (( _p9k_reset_on_line_finish )) || _p9k_segment_in_use status || [[ -o transient_rprompt ]]; then
- _p9k_wrap_zle_widget zle-line-finish _p9k_zle_line_finish
- fi
+ _p9k_wrap_zle_widget zle-line-finish _p9k_zle_line_finish
if _p9k_segment_in_use vi_mode || _p9k_segment_in_use prompt_char; then
_p9k_wrap_zle_widget zle-keymap-select _p9k_zle_keymap_select
@@ -5354,7 +5632,7 @@ _p9k_deinit() {
(( $+functions[gitstatus_stop] )) && gitstatus_stop POWERLEVEL9K
_p9k_deinit_async_pump
(( _p9k__dump_pid )) && wait $_p9k__dump_pid 2>/dev/null
- unset -m '(_POWERLEVEL9K_|P9K_|_p9k_)*~P9K_SSH'
+ unset -m '(_POWERLEVEL9K_|P9K_|_p9k_)*~(P9K_SSH|P9K_TTY)'
}
typeset -gi __p9k_enabled=0
@@ -5488,29 +5766,44 @@ typeset -gr __p9k_p10k_finalize_usage="Usage: %2Fp10k%f %Bfinalize%b
Perform the final stage of initialization. Must be called at the very end of zshrc."
-typeset -gr __p9k_p10k_display_usage="Usage: %2Fp10k%f %Bdisplay%b [-h] [[+|-]part]...
+typeset -gr __p9k_p10k_display_usage="Usage: %2Fp10k%f %Bdisplay%b part-pattern=state-list...
Show, hide or toggle prompt parts. If called from zle, the current
-prompt gets refreshed.
-
-Options:
- part toggle the designated prompt part
- +part show the designated prompt part
- -part hide the designated prompt part
- -h print this help message
+prompt is refreshed.
Parts:
- right right prompt
- s:name segment with the given name (e.g., s:kubecontext)
+ empty_line empty line (duh)
+ ruler ruler; if POWERLEVEL9K_RULER_CHAR=' ', it's essentially another new_line
+ N prompt line number N, 1-based; counting from the top if positive,
+ from the bottom if negative
+ N/left_frame left frame on the Nth line
+ N/left left prompt on the Nth line
+ N/gap gap between left and right prompts on the Nth line
+ N/right right prompt on the Nth line
+ N/right_frame right frame on the Nth line
+ N/left/S segment S within N/left (dir, time, etc.)
+ N/right/S segment S within N/right (dir, time, etc.)
+
+Part States:
+ show the part is displayed
+ hide the part is not displayed
+ print the part is printed in precmd; only applicable to empty_line and
+ ruler; looks better than show after clear; unlike show, the effects
+ of print cannot be undone with hide
Example: Bind Ctrl+P to toggle right prompt.
- function toggle-right-prompt() { p10k display right; }
+ function toggle-right-prompt() { p10k display '*/right'=hide,show; }
zle -N toggle-right-prompt
bindkey '^P' toggle-right-prompt"
+# 0 -- reset-prompt not blocked
+# 1 -- reset-prompt blocked and not needed
+# 2 -- reset-prompt blocked and needed
+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
@@ -5564,64 +5857,52 @@ function p10k() {
print -rP -- $__p9k_p10k_display_usage >&2
return 1
fi
+ if [[ $2 == -h ]]; then
+ print -rP -- $__p9k_p10k_display_usage >&2
+ return 0
+ fi
shift
- local opt
- local -i reset
+ local opt match MATCH prev new pair list name var
+ local -i k
for opt; do
- case $opt in
- -h) print -rP -- $__p9k_p10k_display_usage >&2; return 0;;
- +right)
- if (( $+__p9k_x_right )); then
- reset=1
- unset __p9k_x_right __p9k_x_gap
- fi
- ;;
- -right)
- if (( ! $+__p9k_x_right )); then
- reset=1
- __p9k_x_gap=
- __p9k_x_right=
- fi
- ;;
- right)
- reset=1
- if (( $+__p9k_x_right )); then
- unset __p9k_x_right __p9k_x_gap
- else
- typeset -g __p9k_x_right=
- typeset -g __p9k_x_gap=
- fi
- ;;
- +s:*)
- if (( $+parameters[__p9k_s_${opt:3 }] )); then
- reset=1
- unset __p9k_s_${opt:3 }
- fi
- ;;
- -s:*)
- if (( ! $+parameters[__p9k_s_${opt:3 }] )); then
- reset=1
- typeset -g __p9k_s_${opt:3 }=
- fi
- ;;
- s:*)
- reset=1
- if (( $+parameters[__p9k_s_${opt:2 }] )); then
- unset __p9k_s_${opt:2 }
- else
- typeset -g __p9k_s_${opt:2 }=
- fi
- ;;
- esac
+ pair=(${(s:=:)opt})
+ list=(${(s:,:)${pair[2]}})
+ for k in ${(u@)_p9k__display_k[(I)$pair[1]]:/(#m)*/$_p9k__display_k[$MATCH]}; do
+ if (( $#list == 1 )); then # this branch is purely for optimization
+ [[ $_p9k__display_v[k+1] == $list[1] ]] && continue
+ new=$list[1]
+ else
+ new=${list[list[(I)$_p9k__display_v[k+1]]+1]:-$list[1]}
+ [[ $_p9k__display_v[k+1] == $new ]] && continue
+ fi
+ _p9k__display_v[k+1]=$new
+ name=$_p9k__display_v[k]
+ if [[ $name == (empty_line|ruler) ]]; then
+ var=_p9k__${name}_i
+ [[ $new == show ]] && unset $var || typeset -gi $var=3
+ elif [[ $name == (#b)(<->)(*) ]]; then
+ var=_p9k__${match[1]}${${${${match[2]//\/}/#left/l}/#right/r}/#gap/g}
+ [[ $new == hide ]] && typeset -g $var= || unset $var
+ fi
+ if (( __p9k_reset_state > 0 )); then
+ __p9k_reset_state=2
+ else
+ __p9k_reset_state=-1
+ fi
+ done
done
- (( reset )) && zle && _p9k_reset_prompt || true
+ if (( __p9k_reset_state == -1 )); then
+ _p9k_reset_prompt
+ __p9k_reset_state=0
+ fi
;;
configure)
if (( ARGC > 1 )); then
print -rP -- $__p9k_p10k_configure_usage >&2
return 1
fi
- p9k_configure "$@"
+ p9k_configure "$@" || return
+ _p9k_deinit
;;
help)
local var=__p9k_p10k_$2_usage
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index a8382eef..651ffa1b 100755
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -63,18 +63,18 @@ typeset -r vertical_bar='|'
typeset -r slanted_bar='\uE0BD'
typeset -ra lean_left=(
- '' '${extra_icons[1]:+$extra_icons[1] }%31F$extra_icons[2]%B%39F~%b%31F/%B%39Fsrc%b%f $prefixes[1]%76F$extra_icons[3]master%f '
- '' '%76F❯%f █'
+ '%$frame_color[$color]F╭─ ' '${extra_icons[1]:+$extra_icons[1] }%31F$extra_icons[2]%B%39F~%b%31F/%B%39Fsrc%b%f $prefixes[1]%76F$extra_icons[3]master%f '
+ '%$frame_color[$color]F╰─ ' '%76F❯%f ${buffer:-█}'
)
typeset -ra lean_right=(
- ' $prefixes[2]%101F$extra_icons[4]5s%f${show_time:+ $prefixes[3]%66F$extra_icons[5]16:23:42%f}' ''
- '' ''
+ ' $prefixes[2]%101F$extra_icons[4]5s%f${show_time:+ $prefixes[3]%66F$extra_icons[5]16:23:42%f}' ' %$frame_color[$color]F─╮%f'
+ '' ' %$frame_color[$color]F─╯%f'
)
typeset -ra classic_left=(
'%$frame_color[$color]F╭─' '%F{$bg_color[$color]}$left_tail%K{$bg_color[$color]} ${extra_icons[1]:+$extra_icons[1]%K{$bg_color[$color]\} %$sep_color[$color]F$left_subsep%f }%31F$extra_icons[2]%B%39F~%b%K{$bg_color[$color]}%31F/%B%39Fsrc%b%K{$bg_color[$color]} %$sep_color[$color]F$left_subsep%f %$prefix_color[$color]F$prefixes[1]%76F$extra_icons[3]master %k%$bg_color[$color]F$left_head%f'
- '%$frame_color[$color]F╰─' '%f █'
+ '%$frame_color[$color]F╰─' '%f ${buffer:-█}'
)
typeset -ra classic_right=(
@@ -84,7 +84,7 @@ typeset -ra classic_right=(
typeset -ra pure_left=(
'' '%4F~/src%f %242Fmaster%f %3F5s%f'
- '' '%5F❯%f █'
+ '' '%5F❯%f ${buffer:-█}'
)
typeset -ra pure_right=(
@@ -94,7 +94,7 @@ typeset -ra pure_right=(
typeset -ra rainbow_left=(
'%$frame_color[$color]F╭─' '%F{${${extra_icons[1]:+0}:-4}}$left_tail${extra_icons[1]:+%K{0\} $extra_icons[1] %K{4\}%0F$left_sep}%K{4}%254F $extra_icons[2]%B%255F~%b%K{4}%254F/%B%255Fsrc%b%K{4} %K{2}%4F$left_sep %0F$prefixes[1]$extra_icons[3]master %k%2F$left_head%f'
- '%$frame_color[$color]F╰─' '%f █'
+ '%$frame_color[$color]F╰─' '%f ${buffer:-█}'
)
typeset -ra rainbow_right=(
@@ -116,7 +116,7 @@ function prompt_length() {
typeset ${${(%):-$1%$m(l.x.y)}[-1]}=$m
done
fi
- print $x
+ REPLY=$x
}
function print_prompt() {
@@ -124,17 +124,19 @@ function print_prompt() {
local right=${style}_right
left=("${(@P)left}")
right=("${(@P)right}")
+ (( disable_rprompt )) && right=()
eval "left=(${(@)left:/(#b)(*)/\"$match[1]\"})"
eval "right=(${(@)right:/(#b)(*)/\"$match[1]\"})"
if (( num_lines == 1)); then
left=($left[2] $left[4])
right=($right[1] $right[3])
else
- (( left_frame )) || left=('' $left[2] '' '%76F❯%f █')
+ (( left_frame )) || left=('' $left[2] '' "%76F❯%f ${buffer:-█}")
(( right_frame )) || right=($right[1] '' '' '')
fi
local -i right_indent=prompt_indent
- local -i width=$(prompt_length ${(g::):-$left[1]$left[2]$right[1]$right[2]})
+ prompt_length ${(g::):-$left[1]$left[2]$right[1]$right[2]}
+ local -i width=REPLY
while (( wizard_columns - width <= prompt_indent + right_indent )); do
(( --right_indent ))
done
@@ -142,7 +144,8 @@ function print_prompt() {
for ((i = 1; i < $#left; i+=2)); do
local l=${(g::):-$left[i]$left[i+1]}
local r=${(g::):-$right[i]$right[i+1]}
- local -i gap=$((wizard_columns - prompt_indent - right_indent - $(prompt_length $l$r)))
+ prompt_length $l$r
+ local -i gap=$((wizard_columns - prompt_indent - right_indent - REPLY))
(( num_lines == 2 && i == 1 )) && local fill=$gap_char || local fill=' '
print -n -- ${(pl:$prompt_indent:: :)}
print -nP -- $l
@@ -169,8 +172,8 @@ function flowing() {
shift $((OPTIND-1))
local line word lines=()
for word in "$@"; do
- local n=$(prompt_length ${(g::):-"$line $word"})
- if (( n > wizard_columns )); then
+ prompt_length ${(g::):-"$line $word"}
+ if (( REPLY > wizard_columns )); then
[[ -z $line ]] || lines+=$line
line=
fi
@@ -183,8 +186,8 @@ function flowing() {
done
[[ -z $line ]] || lines+=$line
for line in $lines; do
- local n=$(prompt_length ${(g::)line})
- (( centered && n < wizard_columns )) && print -n -- ${(pl:$(((wizard_columns - n) / 2)):: :)}
+ prompt_length ${(g::)line}
+ (( centered && REPLY < wizard_columns )) && print -n -- ${(pl:$(((wizard_columns - REPLY) / 2)):: :)}
print -P -- $line
done
}
@@ -264,7 +267,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 +291,7 @@ function can_install_font() {
[[ $font == (#b)*' '(<->) ]] || return
iterm2_font_size=$match[1]
terminal=iTerm2
- return
+ return 0
fi
return 1
}
@@ -339,6 +342,9 @@ function install_font() {
'"Use Non-ASCII Font"' 0
'"Ambiguous Double Width"' 0
'"Terminal Type"' '"xterm-256color"'
+ '"Minimum Contrast"' 0.000000
+ '"ASCII Anti Aliased"' 1
+ '"Non-ASCII Anti Aliased"' 1
)
for k v in $settings; do
run_command "" /usr/libexec/PlistBuddy -c \
@@ -503,7 +509,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"
@@ -552,7 +558,7 @@ function ask_style() {
print -n $nl
print -P "%B(1) Lean.%b"
print -n $nl
- style=lean print_prompt
+ style=lean left_frame=0 right_frame=0 print_prompt
print -P ""
print -P "%B(2) Classic.%b"
print -n $nl
@@ -575,7 +581,7 @@ function ask_style() {
case $key in
q) quit;;
r) return 1;;
- 1) style=lean; options+=lean; break;;
+ 1) style=lean; left_frame=0; right_frame=0; options+=lean; break;;
2) style=classic; options+=classic; break;;
3) style=rainbow; options+=rainbow; break;;
4) style=pure; empty_line=1; options+=pure; break;;
@@ -627,8 +633,8 @@ function ask_color() {
done
}
-function ask_frame_color() {
- [[ $style != rainbow || $num_lines == 1 ]] && return
+function ask_ornaments_color() {
+ [[ $style != (rainbow|lean) || $num_lines == 1 ]] && return
[[ $gap_char == ' ' && $left_frame == 0 && $right_frame == 0 ]] && return
if [[ $LINES -lt 26 ]]; then
local nl=''
@@ -637,7 +643,7 @@ function ask_frame_color() {
fi
while true; do
clear
- flowing -c "%BFrame Color%b"
+ flowing -c "%BOrnaments Color%b"
print -n $nl
print -P "%B(1) Lightest.%b"
print -n $nl
@@ -675,7 +681,7 @@ function ask_frame_color() {
function ask_time() {
if (( wizard_columns < 80 )); then
show_time=
- return
+ return 0
fi
while true; do
@@ -751,7 +757,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 +814,7 @@ function ask_prefixes() {
if (( wizard_columns < 80 )); then
prefixes=("$concise[@]")
options+=concise
- return
+ return 0
fi
while true; do
clear
@@ -839,7 +845,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 +932,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 +1001,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 +1111,7 @@ function ask_num_lines() {
function ask_gap_char() {
if [[ $num_lines != 2 ]]; then
- return
+ return 0
fi
while true; do
clear
@@ -1140,8 +1146,8 @@ function ask_gap_char() {
}
function ask_frame() {
- if [[ $style != (classic|rainbow) || $num_lines != 2 ]]; then
- return
+ if [[ $style != (classic|rainbow|lean) || $num_lines != 2 ]]; then
+ return 0
fi
(( LINES >= 26 )) && local nl=$'\n' || local nl=''
@@ -1217,7 +1223,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=''
@@ -1257,27 +1263,53 @@ function ask_instant_prompt() {
done
}
-function ask_confirm() {
+function ask_transient_prompt() {
+ local disable_rprompt=$((num_lines == 1))
+ local prompt_char='%76F❯%f'
+ [[ $style == pure ]] && prompt_char='%5F❯%f'
while true; do
clear
- flowing -c "%BLooks good?%b"
- print -P ""
- print_prompt
- (( empty_line )) && print -P ""
- print_prompt
+ flowing -c "%BEnable Transient Prompt?%b"
print -P ""
print -P "%B(y) Yes.%b"
+ if (( LINES >= 25 || num_lines == 1 )); then
+ print -P ""
+ print -P "${(pl:$prompt_indent:: :)}$prompt_char %2Fgit%f pull"
+ elif (( LINES < 23 )); then
+ print -P ""
+ else
+ print -P "${(pl:$prompt_indent:: :)}$prompt_char %2Fgit%f pull"
+ fi
+ print -P "${(pl:$prompt_indent:: :)}$prompt_char %2Fgit%f branch x"
+ (( empty_line )) && echo
+ buffer="%2Fgit%f checkout x█" print_prompt
+ print -P ""
+ print -P "%B(n) No.%b"
+ if (( LINES >= 25 || num_lines == 1 )); then
+ print -P ""
+ buffer="%2Fgit%f pull" print_prompt
+ (( empty_line )) && echo
+ elif (( LINES < 23 )); then
+ print -P ""
+ else
+ buffer="%2Fgit%f pull" print_prompt
+ (( empty_line )) && echo
+ fi
+ buffer="%2Fgit%f branch x" print_prompt
+ (( empty_line )) && echo
+ buffer="%2Fgit%f checkout x█" print_prompt
print -P ""
print -P "(r) Restart from the beginning."
print -P "(q) Quit and do nothing."
print -P ""
local key=
- read -k key${(%):-"?%BChoice [yrq]: %b"} || quit -c
+ read -k key${(%):-"?%BChoice [ynrq]: %b"} || quit -c
case $key in
q) quit;;
r) return 1;;
- y) break;;
+ y) transient_prompt=1; break;;
+ n) transient_prompt=0; break;;
esac
done
}
@@ -1286,7 +1318,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
@@ -1368,22 +1400,14 @@ function ask_zshrc_edit() {
cp -p $__p9k_zshrc $zshrc_backup || quit -c
print -r -- $zshrc_content >$zshrc_backup || quit -c
zshrc_backup_u=${${TMPDIR:+\$TMPDIR}:-/tmp}/${(q-)zshrc_backup:t}
- break
fi
+ break
;;
esac
done
}
function generate_config() {
- if [[ $style == pure ]]; then
- if [[ -e $__p9k_cfg_path ]]; then
- unlink $__p9k_cfg_path || return
- fi
- cp $__p9k_root_dir/config/p10k-$style.zsh $__p9k_cfg_path || return
- return
- fi
-
local base && base="$(<$__p9k_root_dir/config/p10k-$style.zsh)" || return
local lines=("${(@f)base}")
@@ -1399,154 +1423,180 @@ function generate_config() {
lines=("${(@)lines//$1/$2}")
}
- sub MODE $POWERLEVEL9K_MODE
+ if [[ $style != pure ]]; then
+ sub MODE $POWERLEVEL9K_MODE
+
+ if (( cap_narrow_icons )); then
+ uncomment 'typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION'
+ sub VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER// }'"
+ sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER// }'"
+ sub VPN_IP_VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER// }'"
+ sub OS_ICON_CONTENT_EXPANSION "'%B\${P9K_CONTENT// }'"
+ else
+ sub VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER}'"
+ sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER}'"
+ sub VPN_IP_VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER}'"
+ fi
- if (( cap_narrow_icons )); then
- uncomment 'typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION'
- sub VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER// }'"
- sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER// }'"
- sub VPN_IP_VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER// }'"
- sub OS_ICON_CONTENT_EXPANSION "'%B\${P9K_CONTENT// }'"
- else
- sub VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER}'"
- sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER}'"
- sub VPN_IP_VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER}'"
- fi
+ if [[ $POWERLEVEL9K_MODE == (compatible|powerline) ]]; then
+ # Many fonts don't have the default icons.
+ [[ $POWERLEVEL9K_MODE == compatible ]] && local error='х' || local error='✘'
+ uncomment 'typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION'
+ sub STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION "'$error'"
+ uncomment 'typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION'
+ sub STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION "'$error'"
+ uncomment 'typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION'
+ sub STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION "'$error'"
+ uncomment 'typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION'
+ sub DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION "'∅'"
+ uncomment 'typeset -g POWERLEVEL9K_TERRAFORM_VISUAL_IDENTIFIER_EXPANSION'
+ sub TERRAFORM_VISUAL_IDENTIFIER_EXPANSION "'tf'"
+ uncomment 'typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION'
+ sub RANGER_VISUAL_IDENTIFIER_EXPANSION "'▲'"
+ uncomment 'typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION'
+ sub KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION "'○'"
+ uncomment 'typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION'
+ sub AZURE_VISUAL_IDENTIFIER_EXPANSION "'az'"
+ uncomment 'typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION'
+ sub AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION "'eb'"
+ sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'≡'"
+ fi
- if [[ $POWERLEVEL9K_MODE == (compatible|powerline) ]]; then
- # Many fonts don't have the default icons.
- [[ $POWERLEVEL9K_MODE == compatible ]] && local error='х' || local error='✘'
- uncomment 'typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION'
- sub STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION "'$error'"
- uncomment 'typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION'
- sub STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION "'$error'"
- uncomment 'typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION'
- sub STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION "'$error'"
- uncomment 'typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION'
- sub DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION "'∅'"
- uncomment 'typeset -g POWERLEVEL9K_TERRAFORM_VISUAL_IDENTIFIER_EXPANSION'
- sub TERRAFORM_VISUAL_IDENTIFIER_EXPANSION "'tf'"
- uncomment 'typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION'
- sub RANGER_VISUAL_IDENTIFIER_EXPANSION "'▲'"
- uncomment 'typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION'
- sub KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION "'○'"
- uncomment 'typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION'
- sub AZURE_VISUAL_IDENTIFIER_EXPANSION "'az'"
- uncomment 'typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION'
- sub AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION "'eb'"
- sub BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION "'≡'"
- fi
+ if [[ $POWERLEVEL9K_MODE == (awesome-patched|awesome-fontconfig) && $cap_python == 0 ]]; then
+ uncomment 'typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION'
+ uncomment 'typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION'
+ uncomment 'typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION'
+ uncomment 'typeset -g POWERLEVEL9K_PYTHON_ICON'
+ sub VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION "'🐍'"
+ sub ANACONDA_VISUAL_IDENTIFIER_EXPANSION "'🐍'"
+ sub PYENV_VISUAL_IDENTIFIER_EXPANSION "'🐍'"
+ sub PYTHON_ICON "'🐍'"
+ fi
- if [[ $POWERLEVEL9K_MODE == (awesome-patched|awesome-fontconfig) && $cap_python == 0 ]]; then
- uncomment 'typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION'
- uncomment 'typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION'
- uncomment 'typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION'
- uncomment 'typeset -g POWERLEVEL9K_PYTHON_ICON'
- sub VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION "'🐍'"
- sub ANACONDA_VISUAL_IDENTIFIER_EXPANSION "'🐍'"
- sub PYENV_VISUAL_IDENTIFIER_EXPANSION "'🐍'"
- sub PYTHON_ICON "'🐍'"
- fi
+ if [[ $POWERLEVEL9K_MODE == nerdfont-complete ]]; then
+ sub BATTERY_STAGES "\$'\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'"
+ fi
- if [[ $POWERLEVEL9K_MODE == nerdfont-complete ]]; then
- sub BATTERY_STAGES "\$'\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'"
- fi
+ if [[ $style == (classic|rainbow) ]]; then
+ if [[ $style == classic ]]; then
+ sub BACKGROUND $bg_color[$color]
+ sub LEFT_SUBSEGMENT_SEPARATOR "'%$sep_color[$color]F$left_subsep'"
+ sub RIGHT_SUBSEGMENT_SEPARATOR "'%$sep_color[$color]F$right_subsep'"
+ sub VCS_LOADING_FOREGROUND $sep_color[$color]
+ rep '%248F' "%$prefix_color[$color]F"
+ else
+ sub LEFT_SUBSEGMENT_SEPARATOR "'$left_subsep'"
+ sub RIGHT_SUBSEGMENT_SEPARATOR "'$right_subsep'"
+ fi
+ sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color]
+ sub MULTILINE_FIRST_PROMPT_PREFIX "'%$frame_color[$color]F╭─'"
+ sub MULTILINE_NEWLINE_PROMPT_PREFIX "'%$frame_color[$color]F├─'"
+ sub MULTILINE_LAST_PROMPT_PREFIX "'%$frame_color[$color]F╰─'"
+ sub MULTILINE_FIRST_PROMPT_SUFFIX "'%$frame_color[$color]F─╮'"
+ sub MULTILINE_NEWLINE_PROMPT_SUFFIX "'%$frame_color[$color]F─┤'"
+ sub MULTILINE_LAST_PROMPT_SUFFIX "'%$frame_color[$color]F─╯'"
+ sub LEFT_SEGMENT_SEPARATOR "'$left_sep'"
+ sub RIGHT_SEGMENT_SEPARATOR "'$right_sep'"
+ sub LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL "'$left_tail'"
+ sub LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL "'$left_head'"
+ sub RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL "'$right_head'"
+ sub RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL "'$right_tail'"
+ fi
- if [[ $style == (classic|rainbow) ]]; then
- if [[ $style == classic ]]; then
- sub BACKGROUND $bg_color[$color]
- sub LEFT_SUBSEGMENT_SEPARATOR "'%$sep_color[$color]F$left_subsep'"
- sub RIGHT_SUBSEGMENT_SEPARATOR "'%$sep_color[$color]F$right_subsep'"
- sub VCS_LOADING_FOREGROUND $sep_color[$color]
- rep '%248F' "%$prefix_color[$color]F"
- else
- sub LEFT_SUBSEGMENT_SEPARATOR "'$left_subsep'"
- sub RIGHT_SUBSEGMENT_SEPARATOR "'$right_subsep'"
+ if [[ -n $show_time ]]; then
+ uncomment time
fi
- sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color]
- sub MULTILINE_FIRST_PROMPT_PREFIX "'%$frame_color[$color]F╭─'"
- sub MULTILINE_NEWLINE_PROMPT_PREFIX "'%$frame_color[$color]F├─'"
- sub MULTILINE_LAST_PROMPT_PREFIX "'%$frame_color[$color]F╰─'"
- sub MULTILINE_FIRST_PROMPT_SUFFIX "'%$frame_color[$color]F─╮'"
- sub MULTILINE_NEWLINE_PROMPT_SUFFIX "'%$frame_color[$color]F─┤'"
- sub MULTILINE_LAST_PROMPT_SUFFIX "'%$frame_color[$color]F─╯'"
- sub LEFT_SEGMENT_SEPARATOR "'$left_sep'"
- sub RIGHT_SEGMENT_SEPARATOR "'$right_sep'"
- sub LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL "'$left_tail'"
- sub LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL "'$left_head'"
- sub RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL "'$right_head'"
- sub RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL "'$right_tail'"
- fi
- if [[ -n $show_time ]]; then
- uncomment time
- fi
+ if [[ -n ${(j::)extra_icons} ]]; then
+ local branch_icon=${icons[VCS_BRANCH_ICON]// }
+ sub VCS_BRANCH_ICON "'$branch_icon '"
+ uncomment os_icon
+ else
+ uncomment 'typeset -g POWERLEVEL9K_DIR_CLASSES'
+ uncomment 'typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION'
+ uncomment 'typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION'
+ uncomment 'typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION'
+ sub VCS_VISUAL_IDENTIFIER_EXPANSION ''
+ sub COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION ''
+ sub TIME_VISUAL_IDENTIFIER_EXPANSION ''
+ fi
- if [[ -n ${(j::)extra_icons} ]]; then
- local branch_icon=${icons[VCS_BRANCH_ICON]// }
- sub VCS_BRANCH_ICON "'$branch_icon '"
- uncomment os_icon
- else
- uncomment 'typeset -g POWERLEVEL9K_DIR_CLASSES'
- uncomment 'typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION'
- uncomment 'typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION'
- uncomment 'typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION'
- sub VCS_VISUAL_IDENTIFIER_EXPANSION ''
- sub COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION ''
- sub TIME_VISUAL_IDENTIFIER_EXPANSION ''
- fi
+ if [[ -n ${(j::)prefixes} ]]; then
+ uncomment 'typeset -g POWERLEVEL9K_VCS_PREFIX'
+ uncomment 'typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX'
+ uncomment 'typeset -g POWERLEVEL9K_CONTEXT_PREFIX'
+ uncomment 'typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX'
+ uncomment 'typeset -g POWERLEVEL9K_TIME_PREFIX'
+ if [[ $style == (lean|classic) ]]; then
+ [[ $style == classic ]] && local fg="%$prefix_color[$color]F" || local fg="%f"
+ sub VCS_PREFIX "'${fg}on '"
+ sub COMMAND_EXECUTION_TIME_PREFIX "'${fg}took '"
+ sub CONTEXT_PREFIX "'${fg}with '"
+ sub KUBECONTEXT_PREFIX "'${fg}at '"
+ sub TIME_PREFIX "'${fg}at '"
+ sub CONTEXT_TEMPLATE "'%n$fg at %180F%m'"
+ sub CONTEXT_ROOT_TEMPLATE "'%n$fg at %227F%m'"
+ else
+ sub CONTEXT_TEMPLATE "'%n at %m'"
+ sub CONTEXT_ROOT_TEMPLATE "'%n at %m'"
+ fi
+ fi
- if [[ -n ${(j::)prefixes} ]]; then
- uncomment 'typeset -g POWERLEVEL9K_VCS_PREFIX'
- uncomment 'typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX'
- uncomment 'typeset -g POWERLEVEL9K_CONTEXT_PREFIX'
- uncomment 'typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX'
- uncomment 'typeset -g POWERLEVEL9K_TIME_PREFIX'
- if [[ $style == (lean|classic) ]]; then
- [[ $style == classic ]] && local fg="%$prefix_color[$color]F" || local fg="%f"
- sub VCS_PREFIX "'${fg}on '"
- sub COMMAND_EXECUTION_TIME_PREFIX "'${fg}took '"
- sub CONTEXT_PREFIX "'${fg}with '"
- sub KUBECONTEXT_PREFIX "'${fg}at '"
- sub TIME_PREFIX "'${fg}at '"
- sub CONTEXT_TEMPLATE "'%n$fg at %180F%m'"
- sub CONTEXT_ROOT_TEMPLATE "'%n$fg at %227F%m'"
- else
- sub CONTEXT_TEMPLATE "'%n at %m'"
- sub CONTEXT_ROOT_TEMPLATE "'%n at %m'"
+ if (( num_lines == 1 )); then
+ local -a tmp
+ local line
+ for line in "$lines[@]"; do
+ [[ $line == (' newline'|*'===[ Line #'*) ]] || tmp+=$line
+ done
+ lines=("$tmp[@]")
fi
- fi
- if (( num_lines == 1 )); then
- local -a tmp
- local line
- for line in "$lines[@]"; do
- [[ $line == (' newline'|*'===[ Line #'*) ]] || tmp+=$line
- done
- lines=("$tmp[@]")
- fi
+ sub MULTILINE_FIRST_PROMPT_GAP_CHAR "'$gap_char'"
- sub MULTILINE_FIRST_PROMPT_GAP_CHAR "'$gap_char'"
+ if [[ $style == (classic|rainbow) && $num_lines == 2 ]]; then
+ if (( ! right_frame )); then
+ sub MULTILINE_FIRST_PROMPT_SUFFIX ''
+ sub MULTILINE_NEWLINE_PROMPT_SUFFIX ''
+ sub MULTILINE_LAST_PROMPT_SUFFIX ''
+ fi
+ if (( ! left_frame )); then
+ sub MULTILINE_FIRST_PROMPT_PREFIX ''
+ sub MULTILINE_NEWLINE_PROMPT_PREFIX ''
+ sub MULTILINE_LAST_PROMPT_PREFIX ''
+ sub STATUS_OK false
+ sub STATUS_ERROR false
+ fi
+ fi
- if [[ $style == (classic|rainbow) && $num_lines == 2 ]]; then
- if (( ! right_frame )); then
- sub MULTILINE_FIRST_PROMPT_SUFFIX ''
- sub MULTILINE_NEWLINE_PROMPT_SUFFIX ''
- sub MULTILINE_LAST_PROMPT_SUFFIX ''
+ if [[ $style == lean ]]; then
+ sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color]
+ if (( right_frame )); then
+ sub MULTILINE_FIRST_PROMPT_SUFFIX "'%$frame_color[$color]F─╮'"
+ sub MULTILINE_NEWLINE_PROMPT_SUFFIX "'%$frame_color[$color]F─┤'"
+ sub MULTILINE_LAST_PROMPT_SUFFIX "'%$frame_color[$color]F─╯'"
+ sub RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL "' '"
+ fi
+ if (( left_frame )); then
+ sub MULTILINE_FIRST_PROMPT_PREFIX "'%$frame_color[$color]F╭─'"
+ sub MULTILINE_NEWLINE_PROMPT_PREFIX "'%$frame_color[$color]F├─'"
+ sub MULTILINE_LAST_PROMPT_PREFIX "'%$frame_color[$color]F╰─'"
+ sub LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL "' '"
+ fi
fi
- if (( ! left_frame )); then
- sub MULTILINE_FIRST_PROMPT_PREFIX ''
- sub MULTILINE_NEWLINE_PROMPT_PREFIX ''
- sub MULTILINE_LAST_PROMPT_PREFIX ''
- uncomment prompt_char
- sub STATUS_OK false
- sub STATUS_ERROR false
+
+ if [[ $style == (classic|rainbow) ]]; then
+ if (( num_lines == 2 && ! left_frame )); then
+ uncomment prompt_char
+ else
+ uncomment vi_mode
+ fi
fi
- fi
- (( empty_line )) && sub PROMPT_ADD_NEWLINE true || sub PROMPT_ADD_NEWLINE false
+ (( empty_line )) && sub PROMPT_ADD_NEWLINE true || sub PROMPT_ADD_NEWLINE false
+ fi
sub INSTANT_PROMPT $instant_prompt
+ (( transient_prompt )) && sub TRANSIENT_PROMPT always
local header=${(%):-"# Generated by Powerlevel10k configuration wizard on %D{%Y-%m-%d at %H:%M %Z}."}$'\n'
header+="# Based on romkatv/powerlevel10k/config/p10k-$style.zsh"
@@ -1630,7 +1680,7 @@ while true; do
local -i zshrc_has_cfg=0 zshrc_has_instant_prompt=0 write_zshrc=0
local POWERLEVEL9K_MODE= style= config_backup= config_backup_u= gap_char=' '
local left_subsep= right_subsep= left_tail= right_tail= left_head= right_head= show_time=
- local -i num_lines=0 empty_line=0 color=2 left_frame=1 right_frame=1
+ local -i num_lines=0 empty_line=0 color=2 left_frame=1 right_frame=1 transient_prompt=0
local -i cap_diamond=0 cap_python=0 cap_debian=0 cap_narrow_icons=0 cap_lock=0
local -a extra_icons=('' '' '')
local -a prefixes=('' '')
@@ -1690,26 +1740,26 @@ while true; do
right_head=$fade_in
fi
_p9k_init_icons
- ask_narrow_icons || continue
- ask_style || continue
+ ask_narrow_icons || continue
+ ask_style || continue
if [[ $style != pure ]]; then
- ask_color || continue
- ask_time || continue
- ask_separators || continue
- ask_heads || continue
- ask_tails || continue
- ask_num_lines || continue
- ask_gap_char || continue
- ask_frame || continue
- ask_frame_color || continue
- ask_empty_line || continue
- ask_extra_icons || continue
- ask_prefixes || continue
+ ask_color || continue
+ ask_time || continue
+ ask_separators || continue
+ ask_heads || continue
+ ask_tails || continue
+ ask_num_lines || continue
+ ask_gap_char || continue
+ ask_frame || continue
+ ask_ornaments_color || continue
+ ask_empty_line || continue
+ ask_extra_icons || continue
+ ask_prefixes || continue
fi
- ask_confirm || continue
- ask_instant_prompt || continue
- ask_config_overwrite || continue
- ask_zshrc_edit || continue
+ ask_transient_prompt || continue
+ ask_instant_prompt || continue
+ ask_config_overwrite || continue
+ ask_zshrc_edit || continue
break
done
diff --git a/powerlevel10k.zsh-theme b/powerlevel10k.zsh-theme
index b2bb0954..98ddc24b 100644
--- a/powerlevel10k.zsh-theme
+++ b/powerlevel10k.zsh-theme
@@ -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