mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-25 00:21:58 +00:00
allow dir styling based on the pair: $PWD and whether it's writable
fixes #678
This commit is contained in:
parent
f14ffcff2c
commit
459af1f238
6 changed files with 207 additions and 155 deletions
|
@ -268,51 +268,61 @@
|
|||
# the full directory that was used in previous commands.
|
||||
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
|
||||
|
||||
# Enable special styling for non-writable directories.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
|
||||
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE
|
||||
# above must be set to true for this parameter to have effect.
|
||||
# typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
# Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and
|
||||
# POWERLEVEL9K_DIR_CLASSES below.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
|
||||
|
||||
# Custom prefix.
|
||||
# typeset -g POWERLEVEL9K_DIR_PREFIX='%248Fin '
|
||||
# The default icon shown next to non-writable directories when POWERLEVEL9K_DIR_SHOW_WRITABLE is
|
||||
# set to v2.
|
||||
# typeset -g POWERLEVEL9K_LOCK_ICON='⭐'
|
||||
|
||||
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different directories.
|
||||
# It must be an array with 3 * N elements. Each triplet consists of:
|
||||
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different
|
||||
# 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.
|
||||
# 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.
|
||||
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins.
|
||||
#
|
||||
# Example:
|
||||
# If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v2 and the current directory is not writable,
|
||||
# its class gets suffix _NOT_WRITABLE.
|
||||
#
|
||||
# For example, given these settings:
|
||||
#
|
||||
# typeset -g POWERLEVEL9K_DIR_CLASSES=(
|
||||
# '~/work(|/*)' WORK '(╯°□°)╯︵ ┻━┻'
|
||||
# '~(|/*)' HOME '⌂'
|
||||
# '*' DEFAULT '')
|
||||
# '~/work(|/*)' WORK ''
|
||||
# '~(|/*)' HOME ''
|
||||
# '*' DEFAULT '')
|
||||
#
|
||||
# With these settings, the current directory in the prompt may look like this:
|
||||
# Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with class
|
||||
# WORK or WORK_NOT_WRITABLE.
|
||||
#
|
||||
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent
|
||||
#
|
||||
# Or like this:
|
||||
#
|
||||
# ⌂ ~/best/powerlevel10k
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
# # Styling for WORK.
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103
|
||||
# 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=()
|
||||
|
||||
# Custom prefix.
|
||||
# typeset -g POWERLEVEL9K_DIR_PREFIX='%248Fin '
|
||||
|
||||
#####################################[ vcs: git status ]######################################
|
||||
# Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon.
|
||||
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
|
||||
|
|
|
@ -262,51 +262,61 @@
|
|||
# the full directory that was used in previous commands.
|
||||
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
|
||||
|
||||
# Enable special styling for non-writable directories.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
|
||||
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE
|
||||
# above must be set to true for this parameter to have effect.
|
||||
# typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
# Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and
|
||||
# POWERLEVEL9K_DIR_CLASSES below.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
|
||||
|
||||
# The default icon shown next to non-writable directories when POWERLEVEL9K_DIR_SHOW_WRITABLE is
|
||||
# set to v2.
|
||||
# typeset -g POWERLEVEL9K_LOCK_ICON='⭐'
|
||||
|
||||
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different
|
||||
# directories. It must be an array with 3 * N elements. Each triplet consists of:
|
||||
#
|
||||
# 1. A pattern against which the current directory ($PWD) is matched. Matching is done with
|
||||
# extended_glob option enabled.
|
||||
# 2. Directory class for the purpose of styling.
|
||||
# 3. An empty string.
|
||||
#
|
||||
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins.
|
||||
#
|
||||
# If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v2 and the current directory is not writable,
|
||||
# its class gets suffix _NOT_WRITABLE.
|
||||
#
|
||||
# For example, given these settings:
|
||||
#
|
||||
# typeset -g POWERLEVEL9K_DIR_CLASSES=(
|
||||
# '~/work(|/*)' WORK ''
|
||||
# '~(|/*)' HOME ''
|
||||
# '*' DEFAULT '')
|
||||
#
|
||||
# Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with class
|
||||
# WORK or WORK_NOT_WRITABLE.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# # 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
|
||||
#
|
||||
# # Styling for WORK_NOT_WRITABLE.
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
# 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
|
||||
#
|
||||
# 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=()
|
||||
|
||||
# Custom prefix.
|
||||
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin '
|
||||
|
||||
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different 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
|
||||
# extended_glob option enabled.
|
||||
# 2. Directory class for the purpose of styling.
|
||||
# 3. Icon.
|
||||
#
|
||||
# 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:
|
||||
#
|
||||
# typeset -g POWERLEVEL9K_DIR_CLASSES=(
|
||||
# '~/work(|/*)' WORK '(╯°□°)╯︵ ┻━┻'
|
||||
# '~(|/*)' HOME '⌂'
|
||||
# '*' DEFAULT '')
|
||||
#
|
||||
# With these settings, the current directory in the prompt may look like this:
|
||||
#
|
||||
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent
|
||||
#
|
||||
# Or like this:
|
||||
#
|
||||
# ⌂ ~/best/powerlevel10k
|
||||
#
|
||||
# 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=31
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39
|
||||
#
|
||||
# typeset -g POWERLEVEL9K_DIR_CLASSES=()
|
||||
|
||||
#####################################[ vcs: git status ]######################################
|
||||
# Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon.
|
||||
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
|
||||
|
|
|
@ -262,51 +262,61 @@
|
|||
# the full directory that was used in previous commands.
|
||||
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
|
||||
|
||||
# Enable special styling for non-writable directories.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
|
||||
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE
|
||||
# above must be set to true for this parameter to have effect.
|
||||
# typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
# Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and
|
||||
# POWERLEVEL9K_DIR_CLASSES below.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
|
||||
|
||||
# Custom prefix.
|
||||
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin '
|
||||
# The default icon shown next to non-writable directories when POWERLEVEL9K_DIR_SHOW_WRITABLE is
|
||||
# set to v2.
|
||||
# typeset -g POWERLEVEL9K_LOCK_ICON='⭐'
|
||||
|
||||
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different directories.
|
||||
# It must be an array with 3 * N elements. Each triplet consists of:
|
||||
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different
|
||||
# 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.
|
||||
# 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.
|
||||
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins.
|
||||
#
|
||||
# Example:
|
||||
# If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v2 and the current directory is not writable,
|
||||
# its class gets suffix _NOT_WRITABLE.
|
||||
#
|
||||
# For example, given these settings:
|
||||
#
|
||||
# typeset -g POWERLEVEL9K_DIR_CLASSES=(
|
||||
# '~/work(|/*)' WORK '(╯°□°)╯︵ ┻━┻'
|
||||
# '~(|/*)' HOME '⌂'
|
||||
# '*' DEFAULT '')
|
||||
# '~/work(|/*)' WORK ''
|
||||
# '~(|/*)' HOME ''
|
||||
# '*' DEFAULT '')
|
||||
#
|
||||
# With these settings, the current directory in the prompt may look like this:
|
||||
# Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with class
|
||||
# WORK or WORK_NOT_WRITABLE.
|
||||
#
|
||||
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent
|
||||
#
|
||||
# Or like this:
|
||||
#
|
||||
# ⌂ ~/best/powerlevel10k
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
# # Styling for WORK.
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103
|
||||
# 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=()
|
||||
|
||||
# Custom prefix.
|
||||
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin '
|
||||
|
||||
#####################################[ vcs: git status ]######################################
|
||||
# Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon.
|
||||
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
|
||||
|
|
|
@ -268,52 +268,63 @@
|
|||
# the full directory that was used in previous commands.
|
||||
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
|
||||
|
||||
# Enable special styling for non-writable directories.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
|
||||
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE
|
||||
# above must be set to true for this parameter to have effect.
|
||||
# typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
# Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and
|
||||
# POWERLEVEL9K_DIR_CLASSES below.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
|
||||
|
||||
# Custom prefix.
|
||||
# typeset -g POWERLEVEL9K_DIR_PREFIX='in '
|
||||
# The default icon shown next to non-writable directories when POWERLEVEL9K_DIR_SHOW_WRITABLE is
|
||||
# set to v2.
|
||||
# typeset -g POWERLEVEL9K_LOCK_ICON='⭐'
|
||||
|
||||
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different directories.
|
||||
# It must be an array with 3 * N elements. Each triplet consists of:
|
||||
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different
|
||||
# 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.
|
||||
# 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.
|
||||
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins.
|
||||
#
|
||||
# Example:
|
||||
# If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v2 and the current directory is not writable,
|
||||
# its class gets suffix _NOT_WRITABLE.
|
||||
#
|
||||
# For example, given these settings:
|
||||
#
|
||||
# typeset -g POWERLEVEL9K_DIR_CLASSES=(
|
||||
# '~/work(|/*)' WORK '(╯°□°)╯︵ ┻━┻'
|
||||
# '~(|/*)' HOME '⌂'
|
||||
# '*' DEFAULT '')
|
||||
# '~/work(|/*)' WORK ''
|
||||
# '~(|/*)' HOME ''
|
||||
# '*' DEFAULT '')
|
||||
#
|
||||
# With these settings, the current directory in the prompt may look like this:
|
||||
# Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with class
|
||||
# WORK or WORK_NOT_WRITABLE.
|
||||
#
|
||||
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent
|
||||
#
|
||||
# Or like this:
|
||||
#
|
||||
# ⌂ ~/best/powerlevel10k
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
# # Styling for WORK.
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_BACKGROUND=4
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=254
|
||||
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=250
|
||||
# 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=()
|
||||
|
||||
# Custom prefix.
|
||||
# typeset -g POWERLEVEL9K_DIR_PREFIX='in '
|
||||
|
||||
#####################################[ vcs: git status ]######################################
|
||||
# Version control system colors.
|
||||
# typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2
|
||||
|
|
|
@ -1878,23 +1878,26 @@ prompt_dir() {
|
|||
;;
|
||||
esac
|
||||
|
||||
[[ $_POWERLEVEL9K_DIR_SHOW_WRITABLE == 1 && ! -w $_p9k__cwd ]]
|
||||
[[ $_POWERLEVEL9K_DIR_SHOW_WRITABLE != 0 && ! -w $_p9k__cwd ]]
|
||||
local w=$?
|
||||
if ! _p9k_cache_ephemeral_get $0 $_p9k__cwd $p $w $fake_first "${parts[@]}"; then
|
||||
local state=$0
|
||||
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
|
||||
state+=_NOT_WRITABLE
|
||||
if (( _POWERLEVEL9K_DIR_SHOW_WRITABLE == 1 )); then
|
||||
state=${0}_NOT_WRITABLE
|
||||
else
|
||||
state+=_NOT_WRITABLE
|
||||
fi
|
||||
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
|
||||
|
||||
local style=%b
|
||||
|
@ -1919,9 +1922,11 @@ prompt_dir() {
|
|||
fi
|
||||
|
||||
local last_style=
|
||||
(( _POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD )) && last_style+=%B
|
||||
if (( $+_POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND )); then
|
||||
_p9k_translate_color $_POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
|
||||
_p9k_param $state PATH_HIGHLIGHT_BOLD ''
|
||||
[[ $_p9k__ret == true ]] && last_style+=%B
|
||||
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
|
||||
last_style+=$_p9k__ret
|
||||
fi
|
||||
|
@ -1931,9 +1936,11 @@ prompt_dir() {
|
|||
fi
|
||||
|
||||
local anchor_style=
|
||||
(( _POWERLEVEL9K_DIR_ANCHOR_BOLD )) && anchor_style+=%B
|
||||
if (( $+_POWERLEVEL9K_DIR_ANCHOR_FOREGROUND )); then
|
||||
_p9k_translate_color $_POWERLEVEL9K_DIR_ANCHOR_FOREGROUND
|
||||
_p9k_param $state ANCHOR_BOLD ''
|
||||
[[ $_p9k__ret == true ]] && anchor_style+=%B
|
||||
if (( $+parameters[_POWERLEVEL9K_DIR_ANCHOR_FOREGROUND] ||
|
||||
$+parameters[_POWERLEVEL9K_${(U)state}_ANCHOR_FOREGROUND] )); then
|
||||
_p9k_color $state ANCHOR_FOREGROUND ''
|
||||
_p9k_foreground $_p9k__ret
|
||||
anchor_style+=$_p9k__ret
|
||||
fi
|
||||
|
@ -1949,8 +1956,9 @@ prompt_dir() {
|
|||
parts=("${(@)parts/$'\2'}")
|
||||
fi
|
||||
|
||||
if (( $+_POWERLEVEL9K_DIR_SHORTENED_FOREGROUND )); then
|
||||
_p9k_translate_color $_POWERLEVEL9K_DIR_SHORTENED_FOREGROUND
|
||||
if (( $+parameters[_POWERLEVEL9K_DIR_SHORTENED_FOREGROUND] ||
|
||||
$+parameters[_POWERLEVEL9K_${(U)state}_SHORTENED_FOREGROUND] )); then
|
||||
_p9k_color $state SHORTENED_FOREGROUND ''
|
||||
_p9k_foreground $_p9k__ret
|
||||
(( expand )) && _p9k_escape_style $_p9k__ret
|
||||
local shortened_fg=$_p9k__ret
|
||||
|
@ -1966,13 +1974,15 @@ prompt_dir() {
|
|||
fi
|
||||
|
||||
local sep=''
|
||||
if (( $+_POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND )); then
|
||||
_p9k_translate_color $_POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND
|
||||
if (( $+parameters[_POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND] ||
|
||||
$+parameters[_POWERLEVEL9K_${(U)state}_PATH_SEPARATOR_FOREGROUND] )); then
|
||||
_p9k_color $state PATH_SEPARATOR_FOREGROUND ''
|
||||
_p9k_foreground $_p9k__ret
|
||||
(( expand )) && _p9k_escape_style $_p9k__ret
|
||||
sep=$_p9k__ret
|
||||
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 == *%* ]] && sep+=$style
|
||||
|
||||
|
@ -6777,19 +6787,18 @@ _p9k_init_params() {
|
|||
_p9k_declare -i POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION 2
|
||||
# Other options: "d 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 -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_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_HYPERLINK 0
|
||||
_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=(
|
||||
.bzr
|
||||
.citc
|
||||
|
@ -7578,7 +7587,7 @@ _p9k_must_init() {
|
|||
[[ $sig == $_p9k__param_sig ]] && return 1
|
||||
_p9k_deinit
|
||||
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+=$'$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'
|
||||
|
|
|
@ -1641,8 +1641,10 @@ function generate_config() {
|
|||
fi
|
||||
|
||||
if [[ $POWERLEVEL9K_MODE == (compatible|powerline) ]]; then
|
||||
uncomment 'typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION'
|
||||
sub DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION "'∅'"
|
||||
uncomment 'typeset -g POWERLEVEL9K_LOCK_ICON'
|
||||
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'
|
||||
sub RANGER_VISUAL_IDENTIFIER_EXPANSION "'▲'"
|
||||
uncomment 'typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION'
|
||||
|
|
Loading…
Reference in a new issue