allow dir styling based on the pair: $PWD and whether it's writable

fixes #678
pull/690/head
romkatv 5 years ago
parent f14ffcff2c
commit 459af1f238

@ -268,51 +268,61 @@
# the full directory that was used in previous commands. # the full directory that was used in previous commands.
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
# Enable special styling for non-writable directories. # Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true # POWERLEVEL9K_DIR_CLASSES below.
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
# above must be set to true for this parameter to have effect.
# typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Custom prefix. # The default icon shown next to non-writable directories when POWERLEVEL9K_DIR_SHOW_WRITABLE is
# typeset -g POWERLEVEL9K_DIR_PREFIX='%248Fin ' # set to v2.
# typeset -g POWERLEVEL9K_LOCK_ICON='⭐'
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different directories. # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different
# It must be an array with 3 * N elements. Each triplet consists of: # directories. It must be an array with 3 * N elements. Each triplet consists of:
# #
# 1. A pattern against which the current directory is matched. Matching is done with # 1. A pattern against which the current directory ($PWD) is matched. Matching is done with
# extended_glob option enabled. # extended_glob option enabled.
# 2. Directory class for the purpose of styling. # 2. Directory class for the purpose of styling.
# 3. Icon. # 3. An empty string.
#
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins. If there
# are no matches, the directory will have no icon.
# #
# Example: # Triplets are tried in order. The first triplet whose pattern matches $PWD wins.
# #
# typeset -g POWERLEVEL9K_DIR_CLASSES=( # If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v2 and the current directory is not writable,
# '~/work(|/*)' WORK '(╯°□°)╯︵ ┻━┻' # its class gets suffix _NOT_WRITABLE.
# '~(|/*)' HOME '⌂'
# '*' DEFAULT '')
#
# With these settings, the current directory in the prompt may look like this:
# #
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent # For example, given these settings:
# #
# Or like this: # typeset -g POWERLEVEL9K_DIR_CLASSES=(
# '~/work(|/*)' WORK ''
# '~(|/*)' HOME ''
# '*' DEFAULT '')
# #
# ⌂ ~/best/powerlevel10k # Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with class
# WORK or WORK_NOT_WRITABLE.
# #
# You can also set different colors for directories of different classes. Remember to override # Simply assigning classes to directories don't have any visible effects. It merely gives you an
# FOREGROUND, SHORTENED_FOREGROUND and ANCHOR_FOREGROUND for every directory class that you wish # option to define custom colors and icons for different directory classes.
# to have its own color.
# #
# # Styling for WORK.
# typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31 # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103 # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103
# typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39 # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39
# #
# # Styling for WORK_NOT_WRITABLE.
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=31
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=103
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=39
#
# If a styling parameter isn't explicitly defined for some class, it falls back to the classless
# parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls
# back to POWERLEVEL9K_DIR_FOREGROUND.
#
# typeset -g POWERLEVEL9K_DIR_CLASSES=() # typeset -g POWERLEVEL9K_DIR_CLASSES=()
# Custom prefix.
# typeset -g POWERLEVEL9K_DIR_PREFIX='%248Fin '
#####################################[ vcs: git status ]###################################### #####################################[ vcs: git status ]######################################
# 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=

@ -262,51 +262,61 @@
# the full directory that was used in previous commands. # the full directory that was used in previous commands.
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
# Enable special styling for non-writable directories. # Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true # POWERLEVEL9K_DIR_CLASSES below.
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
# above must be set to true for this parameter to have effect.
# typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Custom prefix. # The default icon shown next to non-writable directories when POWERLEVEL9K_DIR_SHOW_WRITABLE is
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin ' # set to v2.
# typeset -g POWERLEVEL9K_LOCK_ICON='⭐'
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different directories. # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different
# It must be an array with 3 * N elements. Each triplet consists of: # directories. It must be an array with 3 * N elements. Each triplet consists of:
# #
# 1. A pattern against which the current directory is matched. Matching is done with # 1. A pattern against which the current directory ($PWD) is matched. Matching is done with
# extended_glob option enabled. # extended_glob option enabled.
# 2. Directory class for the purpose of styling. # 2. Directory class for the purpose of styling.
# 3. Icon. # 3. An empty string.
# #
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins. If there # Triplets are tried in order. The first triplet whose pattern matches $PWD wins.
# are no matches, the directory will have no icon.
# #
# Example: # If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v2 and the current directory is not writable,
# its class gets suffix _NOT_WRITABLE.
# #
# typeset -g POWERLEVEL9K_DIR_CLASSES=( # For example, given these settings:
# '~/work(|/*)' WORK '(╯°□°)╯︵ ┻━┻'
# '~(|/*)' HOME '⌂'
# '*' DEFAULT '')
# #
# With these settings, the current directory in the prompt may look like this: # typeset -g POWERLEVEL9K_DIR_CLASSES=(
# '~/work(|/*)' WORK ''
# '~(|/*)' HOME ''
# '*' DEFAULT '')
# #
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent # Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with class
# WORK or WORK_NOT_WRITABLE.
# #
# Or like this: # Simply assigning classes to directories don't have any visible effects. It merely gives you an
# option to define custom colors and icons for different directory classes.
# #
# ⌂ ~/best/powerlevel10k # # Styling for WORK.
# typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=4
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=4
# typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=4
# #
# You can also set different colors for directories of different classes. Remember to override # # Styling for WORK_NOT_WRITABLE.
# FOREGROUND, SHORTENED_FOREGROUND and ANCHOR_FOREGROUND for every directory class that you wish # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# to have its own color. # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=4
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=4
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=4
# #
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31 # If a styling parameter isn't explicitly defined for some class, it falls back to the classless
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103 # parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls
# typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39 # back to POWERLEVEL9K_DIR_FOREGROUND.
# #
# typeset -g POWERLEVEL9K_DIR_CLASSES=() # typeset -g POWERLEVEL9K_DIR_CLASSES=()
# Custom prefix.
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin '
#####################################[ vcs: git status ]###################################### #####################################[ vcs: git status ]######################################
# 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=

@ -262,51 +262,61 @@
# the full directory that was used in previous commands. # the full directory that was used in previous commands.
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
# Enable special styling for non-writable directories. # Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true # POWERLEVEL9K_DIR_CLASSES below.
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
# above must be set to true for this parameter to have effect.
# typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Custom prefix. # The default icon shown next to non-writable directories when POWERLEVEL9K_DIR_SHOW_WRITABLE is
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin ' # set to v2.
# typeset -g POWERLEVEL9K_LOCK_ICON='⭐'
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different directories. # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different
# It must be an array with 3 * N elements. Each triplet consists of: # directories. It must be an array with 3 * N elements. Each triplet consists of:
# #
# 1. A pattern against which the current directory is matched. Matching is done with # 1. A pattern against which the current directory ($PWD) is matched. Matching is done with
# extended_glob option enabled. # extended_glob option enabled.
# 2. Directory class for the purpose of styling. # 2. Directory class for the purpose of styling.
# 3. Icon. # 3. An empty string.
#
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins. If there
# are no matches, the directory will have no icon.
# #
# Example: # Triplets are tried in order. The first triplet whose pattern matches $PWD wins.
# #
# typeset -g POWERLEVEL9K_DIR_CLASSES=( # If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v2 and the current directory is not writable,
# '~/work(|/*)' WORK '(╯°□°)╯︵ ┻━┻' # its class gets suffix _NOT_WRITABLE.
# '~(|/*)' HOME '⌂'
# '*' DEFAULT '')
#
# With these settings, the current directory in the prompt may look like this:
# #
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent # For example, given these settings:
# #
# Or like this: # typeset -g POWERLEVEL9K_DIR_CLASSES=(
# '~/work(|/*)' WORK ''
# '~(|/*)' HOME ''
# '*' DEFAULT '')
# #
# ⌂ ~/best/powerlevel10k # Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with class
# WORK or WORK_NOT_WRITABLE.
# #
# You can also set different colors for directories of different classes. Remember to override # Simply assigning classes to directories don't have any visible effects. It merely gives you an
# FOREGROUND, SHORTENED_FOREGROUND and ANCHOR_FOREGROUND for every directory class that you wish # option to define custom colors and icons for different directory classes.
# to have its own color.
# #
# # Styling for WORK.
# typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31 # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103 # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103
# typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39 # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39
# #
# # Styling for WORK_NOT_WRITABLE.
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=31
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=103
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=39
#
# If a styling parameter isn't explicitly defined for some class, it falls back to the classless
# parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls
# back to POWERLEVEL9K_DIR_FOREGROUND.
#
# typeset -g POWERLEVEL9K_DIR_CLASSES=() # typeset -g POWERLEVEL9K_DIR_CLASSES=()
# Custom prefix.
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin '
#####################################[ vcs: git status ]###################################### #####################################[ vcs: git status ]######################################
# 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=

@ -268,52 +268,63 @@
# the full directory that was used in previous commands. # the full directory that was used in previous commands.
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
# Enable special styling for non-writable directories. # Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true # POWERLEVEL9K_DIR_CLASSES below.
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
# above must be set to true for this parameter to have effect.
# typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Custom prefix. # The default icon shown next to non-writable directories when POWERLEVEL9K_DIR_SHOW_WRITABLE is
# typeset -g POWERLEVEL9K_DIR_PREFIX='in ' # set to v2.
# typeset -g POWERLEVEL9K_LOCK_ICON='⭐'
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different directories. # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different
# It must be an array with 3 * N elements. Each triplet consists of: # directories. It must be an array with 3 * N elements. Each triplet consists of:
# #
# 1. A pattern against which the current directory is matched. Matching is done with # 1. A pattern against which the current directory ($PWD) is matched. Matching is done with
# extended_glob option enabled. # extended_glob option enabled.
# 2. Directory class for the purpose of styling. # 2. Directory class for the purpose of styling.
# 3. Icon. # 3. An empty string.
#
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins. If there
# are no matches, the directory will have no icon.
# #
# Example: # Triplets are tried in order. The first triplet whose pattern matches $PWD wins.
# #
# typeset -g POWERLEVEL9K_DIR_CLASSES=( # If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v2 and the current directory is not writable,
# '~/work(|/*)' WORK '(╯°□°)╯︵ ┻━┻' # its class gets suffix _NOT_WRITABLE.
# '~(|/*)' HOME '⌂'
# '*' DEFAULT '')
#
# With these settings, the current directory in the prompt may look like this:
# #
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent # For example, given these settings:
# #
# Or like this: # typeset -g POWERLEVEL9K_DIR_CLASSES=(
# '~/work(|/*)' WORK ''
# '~(|/*)' HOME ''
# '*' DEFAULT '')
# #
# ⌂ ~/best/powerlevel10k # Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with class
# WORK or WORK_NOT_WRITABLE.
# #
# You can also set different colors for directories of different classes. Remember to override # Simply assigning classes to directories don't have any visible effects. It merely gives you an
# FOREGROUND, SHORTENED_FOREGROUND and ANCHOR_FOREGROUND for every directory class that you wish # option to define custom colors and icons for different directory classes.
# to have its own color.
# #
# # Styling for WORK.
# typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_DIR_WORK_BACKGROUND=4 # typeset -g POWERLEVEL9K_DIR_WORK_BACKGROUND=4
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=254 # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=254
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=250 # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=250
# typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=255 # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=255
# #
# # Styling for WORK_NOT_WRITABLE.
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_BACKGROUND=4
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=254
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=250
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=255
#
# If a styling parameter isn't explicitly defined for some class, it falls back to the classless
# parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls
# back to POWERLEVEL9K_DIR_FOREGROUND.
#
# typeset -g POWERLEVEL9K_DIR_CLASSES=() # typeset -g POWERLEVEL9K_DIR_CLASSES=()
# Custom prefix.
# typeset -g POWERLEVEL9K_DIR_PREFIX='in '
#####################################[ vcs: git status ]###################################### #####################################[ vcs: git status ]######################################
# Version control system colors. # Version control system colors.
# typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2 # typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2

@ -1878,23 +1878,26 @@ prompt_dir() {
;; ;;
esac esac
[[ $_POWERLEVEL9K_DIR_SHOW_WRITABLE == 1 && ! -w $_p9k__cwd ]] [[ $_POWERLEVEL9K_DIR_SHOW_WRITABLE != 0 && ! -w $_p9k__cwd ]]
local w=$? local w=$?
if ! _p9k_cache_ephemeral_get $0 $_p9k__cwd $p $w $fake_first "${parts[@]}"; then if ! _p9k_cache_ephemeral_get $0 $_p9k__cwd $p $w $fake_first "${parts[@]}"; then
local state=$0 local state=$0
local icon='' local icon=''
local a='' b='' c=''
for a b c in "${_POWERLEVEL9K_DIR_CLASSES[@]}"; do
if [[ $_p9k__cwd == ${~a} ]]; then
[[ -n $b ]] && state+=_${(U)b}
icon=$'\1'$c
break
fi
done
if (( ! w )); then if (( ! w )); then
state+=_NOT_WRITABLE if (( _POWERLEVEL9K_DIR_SHOW_WRITABLE == 1 )); then
state=${0}_NOT_WRITABLE
else
state+=_NOT_WRITABLE
fi
icon=LOCK_ICON icon=LOCK_ICON
else
local a='' b='' c=''
for a b c in "${_POWERLEVEL9K_DIR_CLASSES[@]}"; do
if [[ $_p9k__cwd == ${~a} ]]; then
[[ -n $b ]] && state+=_${(U)b}
icon=$'\1'$c
break
fi
done
fi fi
local style=%b local style=%b
@ -1919,9 +1922,11 @@ prompt_dir() {
fi fi
local last_style= local last_style=
(( _POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD )) && last_style+=%B _p9k_param $state PATH_HIGHLIGHT_BOLD ''
if (( $+_POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND )); then [[ $_p9k__ret == true ]] && last_style+=%B
_p9k_translate_color $_POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND if (( $+parameters[_POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND] ||
$+parameters[_POWERLEVEL9K_${(U)state}_PATH_HIGHLIGHT_FOREGROUND] )); then
_p9k_color $state PATH_HIGHLIGHT_FOREGROUND ''
_p9k_foreground $_p9k__ret _p9k_foreground $_p9k__ret
last_style+=$_p9k__ret last_style+=$_p9k__ret
fi fi
@ -1931,9 +1936,11 @@ prompt_dir() {
fi fi
local anchor_style= local anchor_style=
(( _POWERLEVEL9K_DIR_ANCHOR_BOLD )) && anchor_style+=%B _p9k_param $state ANCHOR_BOLD ''
if (( $+_POWERLEVEL9K_DIR_ANCHOR_FOREGROUND )); then [[ $_p9k__ret == true ]] && anchor_style+=%B
_p9k_translate_color $_POWERLEVEL9K_DIR_ANCHOR_FOREGROUND if (( $+parameters[_POWERLEVEL9K_DIR_ANCHOR_FOREGROUND] ||
$+parameters[_POWERLEVEL9K_${(U)state}_ANCHOR_FOREGROUND] )); then
_p9k_color $state ANCHOR_FOREGROUND ''
_p9k_foreground $_p9k__ret _p9k_foreground $_p9k__ret
anchor_style+=$_p9k__ret anchor_style+=$_p9k__ret
fi fi
@ -1949,8 +1956,9 @@ prompt_dir() {
parts=("${(@)parts/$'\2'}") parts=("${(@)parts/$'\2'}")
fi fi
if (( $+_POWERLEVEL9K_DIR_SHORTENED_FOREGROUND )); then if (( $+parameters[_POWERLEVEL9K_DIR_SHORTENED_FOREGROUND] ||
_p9k_translate_color $_POWERLEVEL9K_DIR_SHORTENED_FOREGROUND $+parameters[_POWERLEVEL9K_${(U)state}_SHORTENED_FOREGROUND] )); then
_p9k_color $state SHORTENED_FOREGROUND ''
_p9k_foreground $_p9k__ret _p9k_foreground $_p9k__ret
(( expand )) && _p9k_escape_style $_p9k__ret (( expand )) && _p9k_escape_style $_p9k__ret
local shortened_fg=$_p9k__ret local shortened_fg=$_p9k__ret
@ -1966,13 +1974,15 @@ prompt_dir() {
fi fi
local sep='' local sep=''
if (( $+_POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND )); then if (( $+parameters[_POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND] ||
_p9k_translate_color $_POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND $+parameters[_POWERLEVEL9K_${(U)state}_PATH_SEPARATOR_FOREGROUND] )); then
_p9k_color $state PATH_SEPARATOR_FOREGROUND ''
_p9k_foreground $_p9k__ret _p9k_foreground $_p9k__ret
(( expand )) && _p9k_escape_style $_p9k__ret (( expand )) && _p9k_escape_style $_p9k__ret
sep=$_p9k__ret sep=$_p9k__ret
fi fi
(( expand )) && _p9k_escape $_POWERLEVEL9K_DIR_PATH_SEPARATOR || _p9k__ret=$_POWERLEVEL9K_DIR_PATH_SEPARATOR _p9k_param $state PATH_SEPARATOR /
(( expand )) && _p9k_escape $_p9k__ret
sep+=$_p9k__ret sep+=$_p9k__ret
[[ $sep == *%* ]] && sep+=$style [[ $sep == *%* ]] && sep+=$style
@ -6777,19 +6787,18 @@ _p9k_init_params() {
_p9k_declare -i POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION 2 _p9k_declare -i POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION 2
# Other options: "d h m s". # Other options: "d h m s".
_p9k_declare -s POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT "H:M:S" _p9k_declare -s POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT "H:M:S"
_p9k_declare -e POWERLEVEL9K_DIR_PATH_SEPARATOR "/"
_p9k_declare -e POWERLEVEL9K_HOME_FOLDER_ABBREVIATION "~" _p9k_declare -e POWERLEVEL9K_HOME_FOLDER_ABBREVIATION "~"
_p9k_declare -b POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD 0
_p9k_declare -b POWERLEVEL9K_DIR_ANCHOR_BOLD 0
_p9k_declare -b POWERLEVEL9K_DIR_PATH_ABSOLUTE 0 _p9k_declare -b POWERLEVEL9K_DIR_PATH_ABSOLUTE 0
_p9k_declare -b POWERLEVEL9K_DIR_SHOW_WRITABLE 0 _p9k_declare -s POWERLEVEL9K_DIR_SHOW_WRITABLE ''
case $_POWERLEVEL9K_DIR_SHOW_WRITABLE in
true) _POWERLEVEL9K_DIR_SHOW_WRITABLE=1;;
v2) _POWERLEVEL9K_DIR_SHOW_WRITABLE=2;;
*) _POWERLEVEL9K_DIR_SHOW_WRITABLE=0;;
esac
typeset -gi _POWERLEVEL9K_DIR_SHOW_WRITABLE
_p9k_declare -b POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER 0 _p9k_declare -b POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER 0
_p9k_declare -b POWERLEVEL9K_DIR_HYPERLINK 0 _p9k_declare -b POWERLEVEL9K_DIR_HYPERLINK 0
_p9k_declare -s POWERLEVEL9K_SHORTEN_STRATEGY "" _p9k_declare -s POWERLEVEL9K_SHORTEN_STRATEGY ""
_p9k_declare -s POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND
_p9k_declare -s POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
_p9k_declare -s POWERLEVEL9K_DIR_ANCHOR_FOREGROUND
_p9k_declare -s POWERLEVEL9K_DIR_SHORTENED_FOREGROUND
local markers=( local markers=(
.bzr .bzr
.citc .citc
@ -7578,7 +7587,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1 [[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit _p9k_deinit
fi fi
_p9k__param_pat=$'v79\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' _p9k__param_pat=$'v80\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1' _p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1' _p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
_p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays\1' _p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays\1'

@ -1641,8 +1641,10 @@ function generate_config() {
fi fi
if [[ $POWERLEVEL9K_MODE == (compatible|powerline) ]]; then if [[ $POWERLEVEL9K_MODE == (compatible|powerline) ]]; then
uncomment 'typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION' uncomment 'typeset -g POWERLEVEL9K_LOCK_ICON'
sub DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION "'∅'" sub LOCK_ICON "'∅'"
uncomment 'typeset -g POWERLEVEL9K_NORDVPN_VISUAL_IDENTIFIER_EXPANSION'
sub NORDVPN_VISUAL_IDENTIFIER_EXPANSION "'nord'"
uncomment 'typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION' uncomment 'typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION'
sub RANGER_VISUAL_IDENTIFIER_EXPANSION "'▲'" sub RANGER_VISUAL_IDENTIFIER_EXPANSION "'▲'"
uncomment 'typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION' uncomment 'typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION'

Loading…
Cancel
Save