Merge branch 'master' into dev

pull/145/head
romkatv 5 years ago
commit 4a59f7f422

@ -114,7 +114,7 @@ fi
typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false
# Show node version only when in a directory tree containing package.json. # Show node version only when in a directory tree containing package.json.
typeset -g P9K_NODE_VERSION_PROJECT_ONLY=true typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true
# Kubernetes context classes for the purpose of using different colors with # Kubernetes context classes for the purpose of using different colors with
# different contexts. # different contexts.

@ -1,9 +1,9 @@
# Config for Powerlevel10k with lean prompt style. Doesn't require a Powerline font. # Config for Powerlevel10k with lean prompt style. Doesn't require a custom font but can take
# The color scheme is suitable for dark terminal background. # advantage of it if available. The color scheme is suitable for dark terminal background.
# #
# Once you've installed Powerlevel10k, run these commands to apply lean style. # Once you've installed Powerlevel10k, run these commands to apply lean style.
# #
# curl -fsSL -O ~/p10k-lean.zsh https://raw.githubusercontent.com/romkatv/powerlevel10k/master/config/p10k-lean.zsh # curl -fsSL -o ~/p10k-lean.zsh https://raw.githubusercontent.com/romkatv/powerlevel10k/master/config/p10k-lean.zsh
# echo 'source ~/p10k-lean.zsh' >>! ~/.zshrc # echo 'source ~/p10k-lean.zsh' >>! ~/.zshrc
# #
# To customize your prompt, open ~/p10k-lean.zsh in your favorite text editor, change it and # To customize your prompt, open ~/p10k-lean.zsh in your favorite text editor, change it and
@ -89,15 +89,18 @@ fi
# such as POWERLEVEL9K_LOCK_ICON='⭐'. This will change the icon in every segment that uses # such as POWERLEVEL9K_LOCK_ICON='⭐'. This will change the icon in every segment that uses
# LOCK_ICON as default icon. If this paragraph looks confusing, forget what it says. # LOCK_ICON as default icon. If this paragraph looks confusing, forget what it says.
# #
# Note: You can use $'\u2B50' instead of '⭐'. It's especially convenient when specifying
# icons that your text editor cannot render. Don't forget to put $ and use single quotes when
# defining icons via Unicode codepoints.
#
# Note: Many default icons cannot be displayed with system fonts. You'll need to install a # Note: Many default icons cannot be displayed with system fonts. You'll need to install a
# Powerline font to use them. See POWERLEVEL9K_MODE below. # capable font to use them. See POWERLEVEL9K_MODE below.
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=
# This option doesn't make a difference unless you've enabled default icons for all or some # This option makes a difference only when default icons are enabled for all or some prompt
# prompt segments (see POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION above). Default icons depend on # segments (see POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION above). LOCK_ICON can be printed as
# the value of POWERLEVEL9K_MODE. For example, LOCK_ICON can be printed as $'\uE0A2', $'\uE138' # $'\uE0A2', $'\uE138' or $'\uF023' depending on POWERLEVEL9K_MODE. The correct value of this
# or $'\uF023' depending on POWERLEVEL9K_MODE. The correct value of this parameter depends on # parameter depends on the provider of the font your terminal is using.
# the provider of the font your terminal is using.
# #
# Font Provider | POWERLEVEL9K_MODE # Font Provider | POWERLEVEL9K_MODE
# ---------------------------------+------------------- # ---------------------------------+-------------------
@ -108,6 +111,13 @@ fi
# Awesome-Terminal Fonts (regular) | awesome-fontconfig # Awesome-Terminal Fonts (regular) | awesome-fontconfig
# Awesome-Terminal Fonts (patched) | awesome-patched # Awesome-Terminal Fonts (patched) | awesome-patched
# Nerd Fonts | nerdfont-complete # Nerd Fonts | nerdfont-complete
# Other | compatible
#
# If this looks overwhelming, either stick with a preinstalled system font and set
# POWERLEVEL9K_MODE=compatible, or install a font from https://github.com/ryanoasis/nerd-fonts
# and set POWERLEVEL9K_MODE=nerdfont-complete. "Meslo LG S Regular Nerd Font Complete Mono" from
# https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/Meslo/S/Regular/complete is
# very good.
typeset -g POWERLEVEL9K_MODE=nerdfont-complete typeset -g POWERLEVEL9K_MODE=nerdfont-complete
# When set to true, icons appear before content on both sides of the prompt. When set # When set to true, icons appear before content on both sides of the prompt. When set
@ -234,7 +244,9 @@ fi
# #
# ⌂ ~/best/powerlevel10k # ⌂ ~/best/powerlevel10k
# #
# You can also set different colors for directories of different classes. # You can also set different colors for directories of different classes. Remember to override
# FOREGROUND, SHORTENED_FOREGROUND and ANCHOR_FOREGROUND for every directory class that you wish
# to have its own color.
# #
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=12 # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=12
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=4 # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=4
@ -274,7 +286,7 @@ fi
# If P9K_CONTENT is not empty, leave it unchanged. It's either "loading" or from vcs_info. # If P9K_CONTENT is not empty, leave it unchanged. It's either "loading" or from vcs_info.
vcs="\${P9K_CONTENT:-$vcs}" vcs="\${P9K_CONTENT:-$vcs}"
# Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. # Branch icon. Set this parameter to $'\uF126 ' for the popular Powerline branch icon.
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
# Disable the default Git status formatting. # Disable the default Git status formatting.
@ -306,15 +318,34 @@ fi
typeset -g POWERLEVEL9K_VCS_STAGED_ICON=$'%{\b+%}' typeset -g POWERLEVEL9K_VCS_STAGED_ICON=$'%{\b+%}'
##########################[ status: exit code of the last command ]########################### ##########################[ status: exit code of the last command ]###########################
# Don't show status on success. Prompt symbol (prompt_char) indicates success with green color. # Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and
# style them independently from the regular OK and ERROR state.
typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true
# Don't show status on success. prompt_char already indicates success with green color.
typeset -g POWERLEVEL9K_STATUS_OK=false typeset -g POWERLEVEL9K_STATUS_OK=false
# Error status color. # Don't show status when it's just an error code (e.g., '1'). prompt_char already indicates errors
# with red color and error codes aren't interesting enough to waste prompt real estate on them.
typeset -g POWERLEVEL9K_STATUS_ERROR=false
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=9 typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=9
# Don't show status unless the last command was terminated by a signal. Your prompt symbol # Show status when the last command was terminated by a signal.
# (prompt_char) indicates error by turning red. Error codes aren't usually interesting but typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
# signals are. This shows signals as "INT", "ABORT", "KILL", etc. You can remove this parameter typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=9
# for more verbose output. # Use terse signal names: "INT" instead of "SIGINT(2)".
typeset -g POWERLEVEL9K_STATUS_ERROR_CONTENT_EXPANSION='${${P9K_CONTENT#SIG}//[!A-Z]}' typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
# Show status when a pipe command fails and the overall exit status is non-zero. It may look
# like this: 0|1. prompt_char is red in this case.
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=9
# Show status when a pipe command fails and the overall exit status is zero. It may look
# like this: 1|0. prompt_char is green in this case.
typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=9
# Custom icons.
# typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='⭐'
###################[ command_execution_time: duration of the last command ]################### ###################[ command_execution_time: duration of the last command ]###################
# Show duration of the last command if takes longer than this many seconds. # Show duration of the last command if takes longer than this many seconds.
@ -325,6 +356,8 @@ fi
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101 typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101
# Duration format: 1d 2h 3m 4s. # Duration format: 1d 2h 3m 4s.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
# Custom icon.
# typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐'
#######################[ background_jobs: presence of background jobs ]####################### #######################[ background_jobs: presence of background jobs ]#######################
# Don't show the number of background jobs. # Don't show the number of background jobs.
@ -333,6 +366,8 @@ fi
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⇶' typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⇶'
# Background jobs icon color. # Background jobs icon color.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_COLOR=2 typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_COLOR=2
# Custom icon.
# typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⭐'
##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]########### ##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]###########
# NordVPN connection indicator color when connected. # NordVPN connection indicator color when connected.
@ -342,6 +377,11 @@ fi
# Uncomment these two lines to hide NordVPN connection indicator when not connected. # Uncomment these two lines to hide NordVPN connection indicator when not connected.
# typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION= # typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION=
# typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION= # typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION=
# Custom icons.
# typeset -g POWERLEVEL9K_NORDVPN_CONNECTED_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTED_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_NORDVPN_CONNECTING_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTING_VISUAL_IDENTIFIER_EXPANSION='⭐'
####################################[ context: user@host ]#################################### ####################################[ context: user@host ]####################################
# Context format: user@host. # Context format: user@host.
@ -353,6 +393,10 @@ fi
# Don't show context unless running with privileges on in SSH. # Don't show context unless running with privileges on in SSH.
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
typeset -g POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true typeset -g POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
# Custom icon.
# typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Custom icon when root.
# typeset -g POWERLEVEL9K_CONTEXT_ROOT_VISUAL_IDENTIFIER_EXPANSION='⭐'
###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]###
# Python virtual environment color. # Python virtual environment color.
@ -361,6 +405,8 @@ fi
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=true typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=true
# Separate environment name from Python version only with a space. # Separate environment name from Python version only with a space.
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
# Custom icon.
# typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
#####################[ anaconda: conda environment (https://conda.io/) ]###################### #####################[ anaconda: conda environment (https://conda.io/) ]######################
# Anaconda environment color. # Anaconda environment color.
@ -369,32 +415,44 @@ fi
typeset -g POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=true typeset -g POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=true
# Separate environment name from Python version only with a space. # Separate environment name from Python version only with a space.
typeset -g POWERLEVEL9K_ANACONDA_{LEFT,RIGHT}_DELIMITER= typeset -g POWERLEVEL9K_ANACONDA_{LEFT,RIGHT}_DELIMITER=
# Custom icon.
# typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐'
################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################
# Pyenv color. # Pyenv color.
typeset -g POWERLEVEL9K_PYENV_FOREGROUND=6 typeset -g POWERLEVEL9K_PYENV_FOREGROUND=6
# Don't show the current Python version if it's the same as global. # Don't show the current Python version if it's the same as global.
typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
# Custom icon.
# typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]##########
# Nodenv color. # Nodenv color.
typeset -g POWERLEVEL9K_NODENV_FOREGROUND=2 typeset -g POWERLEVEL9K_NODENV_FOREGROUND=2
# Don't show node version if it's the same as global: $(nodenv version-name) == $(nodenv global). # Don't show node version if it's the same as global: $(nodenv version-name) == $(nodenv global).
typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false
# Custom icon.
# typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]###############
# Nvm color. # Nvm color.
typeset -g POWERLEVEL9K_NVM_FOREGROUND=2 typeset -g POWERLEVEL9K_NVM_FOREGROUND=2
# Custom icon.
# typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐'
############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ ############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############
# Nodeenv color. # Nodeenv color.
typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=2 typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=2
# Custom icon.
# typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
##############################[ node_version: node.js version ]############################### ##############################[ node_version: node.js version ]###############################
# Node version color. # Node version color.
typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=2 typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=2
# Show node version only when in a directory tree containing package.json. # Show node version only when in a directory tree containing package.json.
typeset -g P9K_NODE_VERSION_PROJECT_ONLY=true typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true
# Custom icon.
# typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
# Kubernetes context classes for the purpose of using different colors with # Kubernetes context classes for the purpose of using different colors with
@ -415,8 +473,12 @@ fi
# '*test*' TEST # to match your needs. Customize them as needed. # '*test*' TEST # to match your needs. Customize them as needed.
'*' DEFAULT) '*' DEFAULT)
# typeset -g POWERLEVEL9K_KUBECONTEXT_PROD_FOREGROUND=1 # typeset -g POWERLEVEL9K_KUBECONTEXT_PROD_FOREGROUND=1
# typeset -g POWERLEVEL9K_KUBECONTEXT_PROD_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=2 # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=2
# typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=3 typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=3
# typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Kubernetes context too long? You can shorten it by defining an expansion. The original # Kubernetes context too long? You can shorten it by defining an expansion. The original
# Kubernetes context that you see in your prompt is stored in ${P9K_CONTENT} when # Kubernetes context that you see in your prompt is stored in ${P9K_CONTENT} when
# the expansion is evaluated. To remove everything up to and including the last '/', # the expansion is evaluated. To remove everything up to and including the last '/',
@ -425,12 +487,15 @@ fi
# are very flexible and fast, too. See reference: # are very flexible and fast, too. See reference:
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion.
typeset POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION='${P9K_CONTENT}' typeset POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION='${P9K_CONTENT}'
# Show the trailing "/default" in kubernetes context. # Show the trailing "/default" in kubernetes context. This makes it easier to define
# POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION by making the format of ${P9K_CONTENT} consistent.
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE=true typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE=true
###############################[ public_ip: public IP address ]############################### ###############################[ public_ip: public IP address ]###############################
# Public IP color. # Public IP color.
typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=144 typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=144
# Custom icon.
# typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐'
################################[ battery: internal battery ]################################# ################################[ battery: internal battery ]#################################
# Show battery in red when it's below this level and not connected to power supply. # Show battery in red when it's below this level and not connected to power supply.
@ -448,6 +513,9 @@ fi
typeset -g POWERLEVEL9K_BATTERY_CHARGED_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= typeset -g POWERLEVEL9K_BATTERY_CHARGED_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
# Don't show the remaining time to charge/discharge. # Don't show the remaining time to charge/discharge.
typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false
# Disable the default icon because POWERLEVEL9K_BATTERY_STAGES is enough to cue the meaning
# of this segment.
typeset -g POWERLEVEL9K_BATTERY_VISUAL_IDENTIFIER_EXPANSION=
####################################[ time: current time ]#################################### ####################################[ time: current time ]####################################
# Current time color. # Current time color.
@ -458,6 +526,8 @@ fi
# commands will contain the start times of their commands as opposed to the default # commands will contain the start times of their commands as opposed to the default
# behavior where they contain the end times of their preceding commands. # behavior where they contain the end times of their preceding commands.
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
# Custom icon.
# typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐'
} }
(( ! p10k_lean_restore_aliases )) || setopt aliases (( ! p10k_lean_restore_aliases )) || setopt aliases

@ -850,22 +850,22 @@ typeset -gr __p9k_prompt_segment_usage="Usage: p9k_prompt_segment [{+|-}re] [-s
Options: Options:
-t text segment's main content; will undergo prompt expansion: '%F{blue}%T%f' will -t text segment's main content; will undergo prompt expansion: '%F{blue}%T%f' will
show as blue current time show as blue current time; default is empty
-i icon segment's icon -i icon segment's icon; default is empty
-r icon is a symbolic reference that needs to be resolved; for example, 'LOCK_ICON' -r icon is a symbolic reference that needs to be resolved; for example, 'LOCK_ICON'
+r icon is already resolved and should be printed literally; for example, '⭐'; +r icon is already resolved and should be printed literally; for example, '⭐';
this is the default; you can also use $'\u2B50' if you don't want to have this is the default; you can also use $'\u2B50' if you don't want to have
non-ascii characters in source code non-ascii characters in source code
-b bg background color; for example, 'blue', '4', or '#0000ff'; empty value means -b bg background color; for example, 'blue', '4', or '#0000ff'; empty value means
transparent background, as in '%k' transparent background, as in '%k'; default is black
-f fg foreground color; for example, 'blue', '4', or '#0000ff'; empty value means -f fg foreground color; for example, 'blue', '4', or '#0000ff'; empty value means
default foreground color, as in '%f' default foreground color, as in '%f'; default is empty
-s state segment's state for the purpose of applying styling options; if you want to -s state segment's state for the purpose of applying styling options; if you want to
to be able to use POWERLEVEL9K parameters to specify different colors or icons to be able to use POWERLEVEL9K parameters to specify different colors or icons
depending on some property, use different states for different values of that depending on some property, use different states for different values of that
property property
-c condition; if empty after parameter expansion and process substitution, the -c condition; if empty after parameter expansion and process substitution, the
segment is hidden; this is an advanced feature, use with caution segment is hidden; this is an advanced feature, use with caution; default is '1'
-e segment's main content will undergo parameter expansion and process -e segment's main content will undergo parameter expansion and process
substitution; the content will be surrounded with double quotes and thus substitution; the content will be surrounded with double quotes and thus
should quote its own double quotes; this is an advanced feature, use with should quote its own double quotes; this is an advanced feature, use with
@ -911,13 +911,12 @@ Example customizations:
POWERLEVEL9K_CORE_PROTECTED_VISUAL_IDENTIFIER_EXPANSION='❎' POWERLEVEL9K_CORE_PROTECTED_VISUAL_IDENTIFIER_EXPANSION='❎'
# Don't show file size when PROTECTED. # Don't show file size when PROTECTED.
POWERLEVEL9K_CORE_PROTECTED_CONTENT_EXPANSION='' POWERLEVEL9K_CORE_PROTECTED_CONTENT_EXPANSION=''"
"
# Type `p9k_prompt_segment -h` for usage. # Type `p9k_prompt_segment -h` for usage.
function p9k_prompt_segment() { function p9k_prompt_segment() {
emulate -L zsh && setopt no_hist_expand extended_glob emulate -L zsh && setopt no_hist_expand extended_glob
local opt state bg fg icon cond text ref=0 expand=0 local opt state bg=0 fg icon cond text ref=0 expand=0
while getopts ':s:b:f:i:c:t:re' opt; do while getopts ':s:b:f:i:c:t:re' opt; do
case $opt in case $opt in
s) state=$OPTARG;; s) state=$OPTARG;;
@ -938,9 +937,11 @@ function p9k_prompt_segment() {
echo -E - $__p9k_prompt_segment_usage >&2 echo -E - $__p9k_prompt_segment_usage >&2
return 1 return 1
} }
(( ref )) || icon=$'\1'$icon if [[ -n $_p9k_prompt_side ]]; then
"_p9k_${_p9k_prompt_side}_prompt_segment" "prompt_${_p9k_segment_name}${state:+_${(U)state}}" \ (( ref )) || icon=$'\1'$icon
"$bg" "${fg:-$_p9k_color1}" "$icon" "$expand" "$cond" "$text" "_p9k_${_p9k_prompt_side}_prompt_segment" "prompt_${_p9k_segment_name}${state:+_${(U)state}}" \
"$bg" "${fg:-$_p9k_color1}" "$icon" "$expand" "$cond" "$text"
fi
return 0 return 0
} }
@ -1190,7 +1191,7 @@ prompt_context() {
################################################################ ################################################################
# User: user (who am I) # User: user (who am I)
prompt_user() { prompt_user() {
if ! _p9k_cache_get $0 $1 $2; then if ! _p9k_cache_get $0; then
local user=$(whoami) local user=$(whoami)
if [[ $_POWERLEVEL9K_ALWAYS_SHOW_USER == 0 && $user == $DEFAULT_USER ]]; then if [[ $_POWERLEVEL9K_ALWAYS_SHOW_USER == 0 && $user == $DEFAULT_USER ]]; then
_p9k_cache_set true _p9k_cache_set true
@ -1231,8 +1232,8 @@ _p9k_custom_prompt() {
################################################################ ################################################################
# Display the duration the command needed to run. # Display the duration the command needed to run.
prompt_command_execution_time() { prompt_command_execution_time() {
(( __p9k_timer_start )) || return (( _p9k_timer_start )) || return
P9K_COMMAND_DURATION_SECONDS=$((__p9k_timer_end - __p9k_timer_start)) P9K_COMMAND_DURATION_SECONDS=$((_p9k_timer_end - _p9k_timer_start))
(( P9K_COMMAND_DURATION_SECONDS >= _POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD )) || return (( P9K_COMMAND_DURATION_SECONDS >= _POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD )) || return
if (( P9K_COMMAND_DURATION_SECONDS < 60 )); then if (( P9K_COMMAND_DURATION_SECONDS < 60 )); then
@ -1468,7 +1469,7 @@ prompt_dir() {
[[ $_POWERLEVEL9K_DIR_SHOW_WRITABLE == 1 && ! -w $PWD ]] [[ $_POWERLEVEL9K_DIR_SHOW_WRITABLE == 1 && ! -w $PWD ]]
local w=$? local w=$?
if ! _p9k_cache_get $0 $2 $PWD $w $fake_first "${parts[@]}"; then if ! _p9k_cache_get $0 $PWD $w $fake_first "${parts[@]}"; then
local state=$0 local state=$0
local icon='' local icon=''
if (( ! w )); then if (( ! w )); then
@ -2061,59 +2062,42 @@ prompt_ssh() {
fi fi
} }
_p9k_exit_code_or_status() {
local ec=$1
if (( _POWERLEVEL9K_STATUS_HIDE_SIGNAME || ec <= 128 )); then
_p9k_ret=$ec
else
_p9k_ret="SIG${signals[$((ec - 127))]}($((ec - 128)))"
fi
}
################################################################ ################################################################
# Status: When an error occur, return the error code, or a cross icon if option is set # Status: When an error occur, return the error code, or a cross icon if option is set
# Display an ok icon when no error occur, or hide the segment if option is set to false # Display an ok icon when no error occur, or hide the segment if option is set to false
prompt_status() { prompt_status() {
if ! _p9k_cache_get "$0" "$2" "$__p9k_exit_code" "${(@)__p9k_pipe_exit_codes}"; then if ! _p9k_cache_get $0 $_p9k_status $_p9k_pipestatus; then
local ec_text (( _p9k_status )) && local state=ERROR || local state=OK
local ec_sum if (( _POWERLEVEL9K_STATUS_EXTENDED_STATES )); then
local ec if (( _p9k_status )); then
if (( $#_p9k_pipestatus > 1 )); then
if (( _POWERLEVEL9K_STATUS_SHOW_PIPESTATUS )); then state+=_PIPE
if (( $#__p9k_pipe_exit_codes > 1 )); then elif (( _p9k_status > 128 )); then
ec_sum=${__p9k_pipe_exit_codes[1]} state+=_SIGNAL
_p9k_exit_code_or_status "${__p9k_pipe_exit_codes[1]}" fi
elif [[ "$_p9k_pipestatus" == *[1-9]* ]]; then
else state+=_PIPE
ec_sum=${__p9k_exit_code}
_p9k_exit_code_or_status "${__p9k_exit_code}"
fi fi
ec_text=$_p9k_ret
for ec in "${(@)__p9k_pipe_exit_codes[2,-1]}"; do
(( ec_sum += ec ))
_p9k_exit_code_or_status "$ec"
ec_text+="|$_p9k_ret"
done
else
ec_sum=${__p9k_exit_code}
# We use __p9k_exit_code instead of the right-most __p9k_pipe_exit_codes item because
# PIPE_FAIL may be set.
_p9k_exit_code_or_status "${__p9k_exit_code}"
ec_text=$_p9k_ret
fi fi
_p9k_cache_val=(:)
if (( ec_sum > 0 )); then if (( _POWERLEVEL9K_STATUS_$state )); then
if (( !_POWERLEVEL9K_STATUS_CROSS && _POWERLEVEL9K_STATUS_VERBOSE )); then if (( _POWERLEVEL9K_STATUS_SHOW_PIPESTATUS )); then
_p9k_cache_val=("$0_ERROR" red yellow1 CARRIAGE_RETURN_ICON 0 '' "$ec_text") local text=${(j:|:)${(@)_p9k_pipestatus:/(#b)(*)/$_p9k_exitcode2str[$match[1]+1]}}
else else
_p9k_cache_val=("$0_ERROR" "$_p9k_color1" red FAIL_ICON 0 '' '') local text=$_p9k_exitcode2str[_p9k_status+1]
fi
if (( _p9k_status )); then
if (( !_POWERLEVEL9K_STATUS_CROSS && _POWERLEVEL9K_STATUS_VERBOSE )); then
_p9k_cache_val=($0_$state red yellow1 CARRIAGE_RETURN_ICON 0 '' "$text")
else
_p9k_cache_val=($0_$state $_p9k_color1 red FAIL_ICON 0 '' '')
fi
elif (( _POWERLEVEL9K_STATUS_VERBOSE || _POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE )); then
[[ $state == OK ]] && text=''
_p9k_cache_val=($0_$state "$_p9k_color1" green OK_ICON 0 '' "$text")
fi fi
elif (( _POWERLEVEL9K_STATUS_OK && (_POWERLEVEL9K_STATUS_VERBOSE || _POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE) )); then
_p9k_cache_val=("$0_OK" "$_p9k_color1" green OK_ICON 0 '' '')
else
return
fi fi
if (( $#__p9k_pipe_exit_codes < 3 )); then if (( $#_p9k_pipestatus < 3 )); then
_p9k_cache_set "${(@)_p9k_cache_val}" _p9k_cache_set "${(@)_p9k_cache_val}"
fi fi
fi fi
@ -2121,14 +2105,14 @@ prompt_status() {
} }
prompt_prompt_char() { prompt_prompt_char() {
if (( __p9k_exit_code )); then if (( _p9k_status )); then
_p9k_prompt_segment $0_ERROR_VIINS "$_p9k_color1" 196 '' 0 '${${KEYMAP:-0}:#vicmd}' '' _p9k_prompt_segment $0_ERROR_VIINS "$_p9k_color1" 196 '' 0 '${${KEYMAP:-0}:#(vicmd|vivis|vivli)}' ''
_p9k_prompt_segment $0_ERROR_VICMD "$_p9k_color1" 196 '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#vicmd0}' '' _p9k_prompt_segment $0_ERROR_VICMD "$_p9k_color1" 196 '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#vicmd0}' ''
_p9k_prompt_segment $0_ERROR_VIVIS "$_p9k_color1" 196 '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#vicmd1}' '' _p9k_prompt_segment $0_ERROR_VIVIS "$_p9k_color1" 196 '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#(vicmd1|vivis?|vivli?)}' ''
else else
_p9k_prompt_segment $0_OK_VIINS "$_p9k_color1" 76 '' 0 '${${KEYMAP:-0}:#vicmd}' '' _p9k_prompt_segment $0_OK_VIINS "$_p9k_color1" 76 '' 0 '${${KEYMAP:-0}:#(vicmd|vivis|vivli)}' ''
_p9k_prompt_segment $0_OK_VICMD "$_p9k_color1" 76 '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#vicmd0}' '' _p9k_prompt_segment $0_OK_VICMD "$_p9k_color1" 76 '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#vicmd0}' ''
_p9k_prompt_segment $0_OK_VIVIS "$_p9k_color1" 76 '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#vicmd1}' '' _p9k_prompt_segment $0_OK_VIVIS "$_p9k_color1" 76 '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#(vicmd1|vivis?|vivli?)}' ''
fi fi
} }
@ -2208,7 +2192,7 @@ prompt_time() {
t=$_p9k_ret t=$_p9k_ret
_p9k_escape $_POWERLEVEL9K_TIME_FORMAT _p9k_escape $_POWERLEVEL9K_TIME_FORMAT
_p9k_prompt_segment "$0" "$_p9k_color2" "$_p9k_color1" "TIME_ICON" 1 '' \ _p9k_prompt_segment "$0" "$_p9k_color2" "$_p9k_color1" "TIME_ICON" 1 '' \
"\${_p9k_line_finish-$t}\${_p9k_line_finish+$_p9k_ret}" "\${_p9k_line_finished-$t}\${_p9k_line_finished+$_p9k_ret}"
else else
_p9k_prompt_segment "$0" "$_p9k_color2" "$_p9k_color1" "TIME_ICON" 0 '' $t _p9k_prompt_segment "$0" "$_p9k_color2" "$_p9k_color1" "TIME_ICON" 0 '' $t
fi fi
@ -2786,13 +2770,13 @@ prompt_vcs() {
# Vi Mode: show editing mode (NORMAL|INSERT|VISUAL) # Vi Mode: show editing mode (NORMAL|INSERT|VISUAL)
prompt_vi_mode() { prompt_vi_mode() {
if [[ -n $_POWERLEVEL9K_VI_INSERT_MODE_STRING ]]; then if [[ -n $_POWERLEVEL9K_VI_INSERT_MODE_STRING ]]; then
_p9k_prompt_segment $0_INSERT "$_p9k_color1" blue '' 0 '${${KEYMAP:-0}:#vicmd}' "$_POWERLEVEL9K_VI_INSERT_MODE_STRING" _p9k_prompt_segment $0_INSERT "$_p9k_color1" blue '' 0 '${${KEYMAP:-0}:#(vicmd|vivis|vivli)}' "$_POWERLEVEL9K_VI_INSERT_MODE_STRING"
fi fi
if (( $+_POWERLEVEL9K_VI_VISUAL_MODE_STRING )); then if (( $+_POWERLEVEL9K_VI_VISUAL_MODE_STRING )); then
_p9k_prompt_segment $0_NORMAL "$_p9k_color1" white '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#vicmd0}' "$_POWERLEVEL9K_VI_COMMAND_MODE_STRING" _p9k_prompt_segment $0_NORMAL "$_p9k_color1" white '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#vicmd0}' "$_POWERLEVEL9K_VI_COMMAND_MODE_STRING"
_p9k_prompt_segment $0_VISUAL "$_p9k_color1" white '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#vicmd1}' "$_POWERLEVEL9K_VI_VISUAL_MODE_STRING" _p9k_prompt_segment $0_VISUAL "$_p9k_color1" white '' 0 '${(M)${:-$KEYMAP$_p9k_region_active}:#(vicmd1|vivis?|vivli?)}' "$_POWERLEVEL9K_VI_VISUAL_MODE_STRING"
else else
_p9k_prompt_segment $0_NORMAL "$_p9k_color1" white '' 0 '${(M)KEYMAP:#vicmd}' "$_POWERLEVEL9K_VI_COMMAND_MODE_STRING" _p9k_prompt_segment $0_NORMAL "$_p9k_color1" white '' 0 '${(M)KEYMAP:#(vicmd|vivis|vivli)}' "$_POWERLEVEL9K_VI_COMMAND_MODE_STRING"
fi fi
} }
@ -3055,7 +3039,8 @@ _p9k_preexec() {
fi fi
unset _p9k_real_zle_rprompt_indent unset _p9k_real_zle_rprompt_indent
fi fi
__p9k_timer_start=EPOCHREALTIME _p9k_preexec_cmd=$2
_p9k_timer_start=EPOCHREALTIME
} }
function _p9k_build_segment() { function _p9k_build_segment() {
@ -3069,8 +3054,6 @@ function _p9k_build_segment() {
} }
function _p9k_set_prompt() { function _p9k_set_prompt() {
unset _p9k_line_finish
unset _p9k_rprompt_override
PROMPT=$_p9k_prompt_prefix_left PROMPT=$_p9k_prompt_prefix_left
RPROMPT= RPROMPT=
@ -3100,7 +3083,9 @@ function _p9k_set_prompt() {
left_idx=_p9k_segment_index left_idx=_p9k_segment_index
_p9k_prompt+=$_p9k_line_suffix_left[i] _p9k_prompt+=$_p9k_line_suffix_left[i]
if (( $+_p9k_dir || (i != num_lines && $#right) )); then if (( $+_p9k_dir || (i != num_lines && $#right) )); then
PROMPT+='${${:-${_p9k_d::=0}${_p9k_rprompt::=${_p9k_rprompt_override-'$right'}}${_p9k_lprompt::='$_p9k_prompt'}}+}' PROMPT+='${${:-${_p9k_d::=0}${_p9k_rprompt::='
[[ -o transient_rprompt ]] && PROMPT+='${_p9k_line_finished-'$right'}' || PROMPT+=$right
PROMPT+='}${_p9k_lprompt::='$_p9k_prompt'}}+}'
PROMPT+=$_p9k_gap_pre PROMPT+=$_p9k_gap_pre
if (( $+_p9k_dir )); then if (( $+_p9k_dir )); then
if (( i == num_lines && (_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS > 0 || _POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT > 0) )); then if (( i == num_lines && (_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS > 0 || _POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT > 0) )); then
@ -3145,6 +3130,7 @@ function _p9k_set_prompt() {
PROMPT+=$_p9k_prompt_suffix_left PROMPT+=$_p9k_prompt_suffix_left
[[ -n $RPROMPT ]] && RPROMPT=$_p9k_prompt_prefix_right$RPROMPT$_p9k_prompt_suffix_right [[ -n $RPROMPT ]] && RPROMPT=$_p9k_prompt_prefix_right$RPROMPT$_p9k_prompt_suffix_right
_p9k_prompt_side=
(( $#_p9k_cache < _POWERLEVEL9K_MAX_CACHE_SIZE )) || _p9k_cache=() (( $#_p9k_cache < _POWERLEVEL9K_MAX_CACHE_SIZE )) || _p9k_cache=()
} }
@ -3165,10 +3151,57 @@ powerlevel9k_refresh_prompt_inplace() {
p9k_refresh_prompt_inplace() { powerlevel9k_refresh_prompt_inplace } p9k_refresh_prompt_inplace() { powerlevel9k_refresh_prompt_inplace }
typeset -gi __p9k_new_status
typeset -ga __p9k_new_pipestatus
_p9k_save_status() {
emulate -L zsh && setopt no_hist_expand extended_glob
local -i pipe
if (( !$+_p9k_line_finished )); then
: # SIGINT
elif (( !$+_p9k_preexec_cmd )); then
# Empty line, comment or parse error.
#
# This case is handled incorrectly:
#
# true | false
# |
#
# Here status=1 and pipestatus=(0 1). Ideally we should ignore pipestatus but we won't.
#
# This works though (unless pipefail is set):
#
# false | true
# |
#
# We get status=1 and pipestatus=(1 0) and correctly ignore pipestatus.
(( _p9k_status == __p9k_new_status )) && return
elif (( $__p9k_new_pipestatus[(I)$__p9k_new_status] )); then # just in case
local cmd=(${(z)_p9k_preexec_cmd})
if [[ $#cmd != 0 && $cmd[1] != '!' && ${(Q)cmd[1]} != coproc ]]; then
local arg
for arg in ${(z)_p9k_preexec_cmd}; do
# '()' is for functions, *';' is for complex commands.
if [[ $arg == ('()'|'&&'|'||'|'&'|'&|'|'&!'|*';') ]]; then
pipe=0
break
elif [[ $arg == *('|'|'|&')* ]]; then
pipe=1
fi
done
fi
fi
_p9k_status=$__p9k_new_status
if (( pipe )); then
_p9k_pipestatus=($__p9k_new_pipestatus)
else
_p9k_pipestatus=($_p9k_status)
fi
}
_p9k_precmd() { _p9k_precmd() {
__p9k_exit_code=$? __p9k_new_status=$?
__p9k_pipe_exit_codes=( $pipestatus ) __p9k_new_pipestatus=($pipestatus)
__p9k_timer_end=EPOCHREALTIME
if (( $+_p9k_real_zle_rprompt_indent )); then if (( $+_p9k_real_zle_rprompt_indent )); then
if [[ -n $_p9k_real_zle_rprompt_indent ]]; then if [[ -n $_p9k_real_zle_rprompt_indent ]]; then
@ -3185,9 +3218,14 @@ _p9k_precmd() {
prompt_opts=(cr percent sp subst) prompt_opts=(cr percent sp subst)
setopt nopromptbang prompt{cr,percent,sp,subst} setopt nopromptbang prompt{cr,percent,sp,subst}
_p9k_timer_end=EPOCHREALTIME
_p9k_save_status
powerlevel9k_refresh_prompt_inplace powerlevel9k_refresh_prompt_inplace
__p9k_timer_start=0 unset _p9k_line_finished
unset _p9k_preexec_cmd
_p9k_timer_start=0
_p9k_region_active=0 _p9k_region_active=0
} }
@ -3363,6 +3401,11 @@ function _p9k_prompt_overflow_bug() {
} }
_p9k_init_vars() { _p9k_init_vars() {
typeset -gi _p9k_reset_on_line_finish
typeset -gF _p9k_timer_start
typeset -gF _p9k_timer_end
typeset -gi _p9k_status
typeset -ga _p9k_pipestatus
typeset -g _p9k_param_sig typeset -g _p9k_param_sig
typeset -g _p9k_ret typeset -g _p9k_ret
typeset -g _p9k_cache_key typeset -g _p9k_cache_key
@ -3568,8 +3611,14 @@ _p9k_init_params() {
_p9k_declare -b POWERLEVEL9K_CHRUBY_SHOW_ENGINE 1 _p9k_declare -b POWERLEVEL9K_CHRUBY_SHOW_ENGINE 1
_p9k_declare -b POWERLEVEL9K_STATUS_CROSS 0 _p9k_declare -b POWERLEVEL9K_STATUS_CROSS 0
_p9k_declare -b POWERLEVEL9K_STATUS_OK 1 _p9k_declare -b POWERLEVEL9K_STATUS_OK 1
_p9k_declare -b POWERLEVEL9K_STATUS_OK_PIPE 1
_p9k_declare -b POWERLEVEL9K_STATUS_ERROR 1
_p9k_declare -b POWERLEVEL9K_STATUS_ERROR_PIPE 1
_p9k_declare -b POWERLEVEL9K_STATUS_ERROR_SIGNAL 1
_p9k_declare -b POWERLEVEL9K_STATUS_SHOW_PIPESTATUS 1 _p9k_declare -b POWERLEVEL9K_STATUS_SHOW_PIPESTATUS 1
_p9k_declare -b POWERLEVEL9K_STATUS_HIDE_SIGNAME 0 _p9k_declare -b POWERLEVEL9K_STATUS_HIDE_SIGNAME 0
_p9k_declare -b POWERLEVEL9K_STATUS_VERBOSE_SIGNAME 1
_p9k_declare -b POWERLEVEL9K_STATUS_EXTENDED_STATES 0
_p9k_declare -b POWERLEVEL9K_STATUS_VERBOSE 1 _p9k_declare -b POWERLEVEL9K_STATUS_VERBOSE 1
_p9k_declare -b POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE 0 _p9k_declare -b POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE 0
# Format for the current time: 09:51:02. See `man 3 strftime`. # Format for the current time: 09:51:02. See `man 3 strftime`.
@ -3671,9 +3720,8 @@ _p9k_wrap_zle_widget() {
function _p9k_zle_line_finish() { function _p9k_zle_line_finish() {
(( __p9k_enabled )) || return (( __p9k_enabled )) || return
[[ ! -o TRANSIENT_RPROMPT ]] || _p9k_rprompt_override= _p9k_line_finished=
_p9k_line_finish= (( _p9k_reset_on_line_finish )) && zle && zle .reset-prompt && zle -R
zle && zle .reset-prompt && zle -R
} }
function _p9k_zle_line_pre_redraw() { function _p9k_zle_line_pre_redraw() {
@ -3902,8 +3950,11 @@ _p9k_init_prompt() {
_p9k_prompt_prefix_left+="%{$(iterm2_prompt_mark)%}" _p9k_prompt_prefix_left+="%{$(iterm2_prompt_mark)%}"
fi fi
if [[ -o TRANSIENT_RPROMPT && -n "$_p9k_line_segments_right[2,-1]" ]] || [[ -o transient_rprompt && -n "$_p9k_line_segments_right[1,-2]" ]] ||
( _p9k_segment_in_use time && (( _POWERLEVEL9K_TIME_UPDATE_ON_COMMAND )) ); then ( _p9k_segment_in_use time && (( _POWERLEVEL9K_TIME_UPDATE_ON_COMMAND )) )
_p9k_reset_on_line_finish=$((!$?))
if (( _p9k_reset_on_line_finish )) || _p9k_segment_in_use status; then
_p9k_wrap_zle_widget zle-line-finish _p9k_zle_line_finish _p9k_wrap_zle_widget zle-line-finish _p9k_zle_line_finish
fi fi
} }
@ -4152,6 +4203,18 @@ _p9k_init() {
typeset -grA __p9k_char2byte typeset -grA __p9k_char2byte
fi fi
if _p9k_segment_in_use status; then
typeset -g _p9k_exitcode2str=({0..255})
local -i i=2
if (( !_POWERLEVEL9K_STATUS_HIDE_SIGNAME )); then
for ((; i <= $#signals; ++i)); do
local sig=$signals[i]
(( _POWERLEVEL9K_STATUS_VERBOSE_SIGNAME )) && sig="SIG${sig}($((i-1)))"
_p9k_exitcode2str[$((128+i))]=$sig
done
fi
fi
_p9k_wrap_zle_widget zle-keymap-select _p9k_zle_keymap_select _p9k_wrap_zle_widget zle-keymap-select _p9k_zle_keymap_select
} }
@ -4167,10 +4230,6 @@ prompt_powerlevel9k_setup() {
emulate -L zsh && setopt no_hist_expand extended_glob emulate -L zsh && setopt no_hist_expand extended_glob
prompt_powerlevel9k_teardown prompt_powerlevel9k_teardown
__p9k_enabled=1 __p9k_enabled=1
typeset -gF __p9k_timer_start=0
typeset -gF __p9k_timer_end=0
typeset -gi __p9k_exit_code=0
typeset -ga __p9k_pipe_exit_codes=()
add-zsh-hook preexec _p9k_preexec add-zsh-hook preexec _p9k_preexec
add-zsh-hook precmd _p9k_precmd add-zsh-hook precmd _p9k_precmd
} }

Loading…
Cancel
Save