summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-07-18 11:43:49 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-07-18 11:43:49 +0300
commit6dfd92f8c1d60892ea9b2a57e93cd22a8cb75c2a (patch)
tree351dbcb07f4b444fbee5b750e077f1cf19587fe7 /internal
parent620e69fef1f1197998810d373f41b6e2a8fa651d (diff)
allow optional offset in POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER; see #896
Diffstat (limited to 'internal')
-rw-r--r--internal/p10k.zsh13
1 files changed, 6 insertions, 7 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index ab8b1c61..b11f3ffe 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1847,10 +1847,10 @@ prompt_dir() {
done
if [[ -n $_POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER ]]; then
local _2=$'\2'
- if [[ $_POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER == last ]]; then
- (( e = ${parts[(I)*$_2]} ))
+ if [[ $_POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER == last* ]]; then
+ (( e = ${parts[(I)*$_2]} + ${_POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER#*:} ))
else
- (( e = ${parts[(ib:2:)*$_2]} ))
+ (( e = ${parts[(ib:2:)*$_2]} + ${_POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER#*:} ))
fi
if (( e > 1 && e <= $#parts )); then
parts[1,e-1]=()
@@ -6980,9 +6980,8 @@ _p9k_init_params() {
_p9k_declare -e POWERLEVEL9K_SHORTEN_DELIMITER
_p9k_declare -s POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER ''
case $_POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER in
- first) ;;
- last) ;;
- true) _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=last;;
+ first|last) _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER+=:0;;
+ (first|last):(|-)<->);;
*) _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=;;
esac
[[ -z $_POWERLEVEL9K_SHORTEN_FOLDER_MARKER ]] && _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=
@@ -7742,7 +7741,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit
fi
- _p9k__param_pat=$'v100\1'${(q)ZSH_VERSION}$'\1'${(q)ZSH_PATCHLEVEL}$'\1'
+ _p9k__param_pat=$'v101\1'${(q)ZSH_VERSION}$'\1'${(q)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+=$'$GITSTATUS_CACHE_DIR\1$GITSTATUS_AUTO_INSTALL\1${ZLE_RPROMPT_INDENT:-1}\1'