diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2018-03-07 05:07:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-07 05:07:08 +0300 |
commit | 27e256e8af61b4af7d9122e9cf2d2b0c580822e0 (patch) | |
tree | 20e46f7a5246871d2fdf1b8914a45c2050f3e565 /powerlevel9k.zsh-theme | |
parent | 242bc34027f2d539e7f105ba3c996b32d85df905 (diff) | |
parent | d84420d950128025351febc4819ca5465b029fa1 (diff) |
Merge pull request #736 from dualscyther/segments/dir/absolute-truncation
Add absolute truncation option to dir segment
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 52cda48d..c0849a50 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -728,6 +728,11 @@ prompt_dir() { set_default POWERLEVEL9K_SHORTEN_DELIMITER $'\U2026' case "$POWERLEVEL9K_SHORTEN_STRATEGY" in + truncate_absolute_chars) + if [ ${#current_path} -gt $(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#POWERLEVEL9K_SHORTEN_DELIMITER} )) ]; then + current_path=$POWERLEVEL9K_SHORTEN_DELIMITER${current_path:(-POWERLEVEL9K_SHORTEN_DIR_LENGTH)} + fi + ;; truncate_middle) current_path=$(echo "$current_path" | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g") ;; |