diff --git a/functions/icons.zsh b/functions/icons.zsh index 93f3c3b5..3a4909f7 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -35,7 +35,7 @@ case $POWERLEVEL9K_MODE in TODO_ICON $'\u2611' # ☑ BATTERY_ICON $'\uE894' #  DISK_ICON $'\uE1AE ' #  - OK_ICON $'\u2713' # ✓ + OK_ICON $'\u2714' # ✔ FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' NODE_ICON $'\u2B22' # ⬢ @@ -78,7 +78,7 @@ case $POWERLEVEL9K_MODE in VCS_HG_ICON $'\uE1C3 ' #  VCS_SVN_ICON '(svn) ' RUST_ICON '' - PYTHON_ICON $'\U1F40D' # 🐍 + PYTHON_ICON $'\ue63c' #  SWIFT_ICON '' GO_ICON '' PUBLIC_IP_ICON '' @@ -110,7 +110,7 @@ case $POWERLEVEL9K_MODE in TODO_ICON $'\u2611' # ☑ BATTERY_ICON $'\U1F50B' # 🔋 DISK_ICON $'\uF0A0 ' #  - OK_ICON $'\u2713' # ✓ + OK_ICON $'\u2714' # ✔ FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' NODE_ICON $'\u2B22' # ⬢ @@ -148,8 +148,8 @@ case $POWERLEVEL9K_MODE in VCS_GIT_GITLAB_ICON $'\uF296 ' #  VCS_HG_ICON $'\uF0C3 ' #  VCS_SVN_ICON '(svn) ' - RUST_ICON $'\uE6A8' #  - PYTHON_ICON $'\U1F40D' # 🐍 + RUST_ICON $'\uE6A8' #  + PYTHON_ICON $'\ue63c' #  SWIFT_ICON '' GO_ICON '' PUBLIC_IP_ICON '' @@ -252,7 +252,7 @@ case $POWERLEVEL9K_MODE in TODO_ICON $'\u2611' # ☑ BATTERY_ICON $'\U1F50B' # 🔋 DISK_ICON $'hdd ' - OK_ICON $'\u2713' # ✓ + OK_ICON $'\u2714' # ✔ FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' NODE_ICON $'\u2B22' # ⬢ diff --git a/functions/utilities.zsh b/functions/utilities.zsh index 9bd82060..b4bfb838 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -216,7 +216,7 @@ function segmentShouldBeJoined() { # Given a directory path, truncate it according to the settings for # `truncate_from_right` function truncatePathFromRight() { - local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER} + local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER:-1} echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER \ "s@(([^/]{$((POWERLEVEL9K_SHORTEN_DIR_LENGTH))})([^/]{$delim_len}))[^/]+/@\2$POWERLEVEL9K_SHORTEN_DELIMITER/@g" } diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 8c78cb00..a4469406 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1316,12 +1316,12 @@ set_default POWERLEVEL9K_VI_INSERT_MODE_STRING "INSERT" set_default POWERLEVEL9K_VI_COMMAND_MODE_STRING "NORMAL" prompt_vi_mode() { case ${KEYMAP} in - main|viins) - "$1_prompt_segment" "$0_INSERT" "$2" "$DEFAULT_COLOR" "blue" "$POWERLEVEL9K_VI_INSERT_MODE_STRING" - ;; vicmd) "$1_prompt_segment" "$0_NORMAL" "$2" "$DEFAULT_COLOR" "default" "$POWERLEVEL9K_VI_COMMAND_MODE_STRING" ;; + main|viins|*) + "$1_prompt_segment" "$0_INSERT" "$2" "$DEFAULT_COLOR" "blue" "$POWERLEVEL9K_VI_INSERT_MODE_STRING" + ;; esac } @@ -1484,11 +1484,11 @@ prompt_powerlevel9k_setup() { # returns. We need prompt_subst so we can safely run commands in the prompt # without them being double expanded and we need prompt_percent to expand the # common percent escape sequences. - prompt_opts=(subst percent cr) + prompt_opts=(cr percent sp subst) # Borrowed from promptinit, sets the prompt options in case the theme was # not initialized via promptinit. - setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}" + setopt noprompt{bang,cr,percent,sp,subst} "prompt${^prompt_opts[@]}" # Display a warning if the terminal does not support 256 colors local term_colors diff --git a/test/segments/dir.spec b/test/segments/dir.spec index f4842f38..bb0297e2 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -72,6 +72,26 @@ function testTruncationFromRightWorks() { unset POWERLEVEL9K_SHORTEN_STRATEGY } +function testTruncationFromRightWithEmptyDelimiter() { + POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + POWERLEVEL9K_SHORTEN_DELIMITER="" + POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right' + + FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 + mkdir -p $FOLDER + cd $FOLDER + + assertEquals "%K{blue} %F{black}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{blue}%f " "$(build_left_prompt)" + + cd - + rm -fr /tmp/powerlevel9k-test + + unset FOLDER + unset POWERLEVEL9K_SHORTEN_DIR_LENGTH + unset POWERLEVEL9K_SHORTEN_DELIMITER + unset POWERLEVEL9K_SHORTEN_STRATEGY +} + function testTruncateWithFolderMarkerWorks() { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"