mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-29 06:40:08 +00:00
append POWERLEVEL9K_SHORTEN_DELIMITER when shortening with truncate_to_unique; use * as default in this case
This commit is contained in:
parent
15e7d74087
commit
3c5b52750e
2 changed files with 7 additions and 4 deletions
|
@ -32,8 +32,10 @@ function set_default() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _p9k_g_expand() {
|
function _p9k_g_expand() {
|
||||||
|
(( $+parameters[$1] )) || return
|
||||||
local -a ts=("${=$(typeset -p $1)}")
|
local -a ts=("${=$(typeset -p $1)}")
|
||||||
shift ts
|
shift ts
|
||||||
|
local x
|
||||||
for x in "${ts[@]}"; do
|
for x in "${ts[@]}"; do
|
||||||
[[ $x == -* ]] || break
|
[[ $x == -* ]] || break
|
||||||
# Don't change readonly variables. Ideally, we shouldn't modify any variables at all,
|
# Don't change readonly variables. Ideally, we shouldn't modify any variables at all,
|
||||||
|
|
|
@ -792,7 +792,6 @@ set_default POWERLEVEL9K_DIR_SHOW_WRITABLE false
|
||||||
set_default POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER false
|
set_default POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER false
|
||||||
set_default POWERLEVEL9K_SHORTEN_STRATEGY ""
|
set_default POWERLEVEL9K_SHORTEN_STRATEGY ""
|
||||||
set_default POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND ""
|
set_default POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND ""
|
||||||
set_default POWERLEVEL9K_SHORTEN_DELIMITER $'\u2026'
|
|
||||||
# This defines a pattern. It is expanded with the options set by `emulate zsh`.
|
# This defines a pattern. It is expanded with the options set by `emulate zsh`.
|
||||||
# This works pretty well: POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(.bzr|CVS|.git|.hg|.svn|.citc)"
|
# This works pretty well: POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(.bzr|CVS|.git|.hg|.svn|.citc)"
|
||||||
set_default POWERLEVEL9K_SHORTEN_FOLDER_MARKER ".shorten_folder_marker"
|
set_default POWERLEVEL9K_SHORTEN_FOLDER_MARKER ".shorten_folder_marker"
|
||||||
|
@ -830,6 +829,7 @@ prompt_dir() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local -i fake_first=0
|
local -i fake_first=0
|
||||||
|
local delim=${POWERLEVEL9K_SHORTEN_DELIMITER-$'\u2026'}
|
||||||
|
|
||||||
case $POWERLEVEL9K_SHORTEN_STRATEGY in
|
case $POWERLEVEL9K_SHORTEN_STRATEGY in
|
||||||
truncate_absolute|truncate_absolute_chars)
|
truncate_absolute|truncate_absolute_chars)
|
||||||
|
@ -900,13 +900,14 @@ prompt_dir() {
|
||||||
for (( ; i < $#parts; ++i )); do
|
for (( ; i < $#parts; ++i )); do
|
||||||
local dir=$parts[i]
|
local dir=$parts[i]
|
||||||
local -i j=1
|
local -i j=1
|
||||||
for (( ; j <= $#dir; ++j )); do
|
for (( ; j < $#dir; ++j )); do
|
||||||
local -a matching=($parent/$dir[1,j]*/(N))
|
local -a matching=($parent/$dir[1,j]*/(N))
|
||||||
(( $#matching == 1 )) && break
|
(( $#matching == 1 )) && break
|
||||||
done
|
done
|
||||||
parent+=/$dir
|
parent+=/$dir
|
||||||
parts[i]=$dir[1,j]
|
(( j == $#dir )) || parts[i]=$dir[1,j]$'\0'
|
||||||
done
|
done
|
||||||
|
delim=${POWERLEVEL9K_SHORTEN_DELIMITER-'*'}
|
||||||
;;
|
;;
|
||||||
truncate_with_folder_marker)
|
truncate_with_folder_marker)
|
||||||
local dir=$PWD
|
local dir=$PWD
|
||||||
|
@ -962,7 +963,7 @@ prompt_dir() {
|
||||||
last_fg+=$_P9K_RETVAL
|
last_fg+=$_P9K_RETVAL
|
||||||
fi
|
fi
|
||||||
parts[-1]=$last_fg${parts[-1]//$'\0'/$'\0'$last_fg}
|
parts[-1]=$last_fg${parts[-1]//$'\0'/$'\0'$last_fg}
|
||||||
parts=("${(@)parts//$'\0'/$POWERLEVEL9K_SHORTEN_DELIMITER$fg}")
|
parts=("${(@)parts//$'\0'/$delim$fg}")
|
||||||
|
|
||||||
local sep=$POWERLEVEL9K_DIR_PATH_SEPARATOR$fg
|
local sep=$POWERLEVEL9K_DIR_PATH_SEPARATOR$fg
|
||||||
if [[ -n $POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND ]]; then
|
if [[ -n $POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND ]]; then
|
||||||
|
|
Loading…
Reference in a new issue