diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2015-08-05 01:06:06 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2015-08-05 01:06:06 +0300 |
commit | 9efe519dc59ac4efb996aac4a20d50a6f95a398f (patch) | |
tree | 7c941febe25df3061d4d75f4a75f932851d7f718 /powerlevel9k.zsh-theme | |
parent | 6925e35cb8d6c4db40a3aa6127c284684779d42c (diff) | |
parent | 99504d4ad44ea88af8ec6f84c8c38415044e7557 (diff) |
Merge branch 'dritter/improve_shorten_dir_length' of github.com:dritter/powerlevel9k into dritter/improve_shorten_dir_length
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rw-r--r-- | powerlevel9k.zsh-theme | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 8cc2d570..4ee919cc 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -482,8 +482,19 @@ prompt_context() { prompt_dir() { local current_path='%~' if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" ]]; then - # shorten path to $POWERLEVEL9K_SHORTEN_DIR_LENGTH - current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c" + + case "$POWERLEVEL9K_SHORTEN_STRATEGY" in + complete_directories) + current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c" + ;; + truncate_from_right) + current_path=$(pwd | sed -e "s,^$HOME,~," | sed -E "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1..\//g") + ;; + *) + current_path=$(pwd | sed -e "s,^$HOME,~," | sed -E "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1\.\.\2\//g") + ;; + esac + fi $1_prompt_segment "$0" "blue" "$DEFAULT_COLOR" "$current_path" |