From 2bc3b09963f34e3f404556100f28b4bf4e904a92 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 25 Jul 2015 01:34:11 +0200 Subject: Implemented different ways to truncate the directory path. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 71dfceb2..4aec6745 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,18 @@ to a certain length: # Limit to the last two folders POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 +To change the way how the current working directory is truncated, just set: + + # truncate whole directories + POWERLEVEL9K_SHORTEN_STRATEGY="complete_directories" + # truncate from right, leaving the first X characters untouched + POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right" + # default behaviour is to truncate the middle part of the directory + +In each case you have to specify the length you want to shorten the directory +to. So in some cases `POWERLEVEL9K_SHORTEN_DIR_LENGTH` means characters, in +others whole directories. + #### The 'time' segment By default the time is show in 'H:M:S' format. If you want to change it, -- cgit v1.2.3 From 754b648f372924214a32a09205cc4aca7f93af12 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 5 Aug 2015 00:21:09 +0200 Subject: Changed the default behaviour to truncate whole directories. --- README.md | 6 +++--- powerlevel9k.zsh-theme | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 787e98f6..0b130120 100644 --- a/README.md +++ b/README.md @@ -279,11 +279,11 @@ to a certain length: To change the way how the current working directory is truncated, just set: - # truncate whole directories - POWERLEVEL9K_SHORTEN_STRATEGY="complete_directories" + # truncate the middle part + POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle" # truncate from right, leaving the first X characters untouched POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right" - # default behaviour is to truncate the middle part of the directory + # default behaviour is to truncate whole directories In each case you have to specify the length you want to shorten the directory to. So in some cases `POWERLEVEL9K_SHORTEN_DIR_LENGTH` means characters, in diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4ee919cc..7ce0a5f9 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -484,14 +484,14 @@ prompt_dir() { if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" ]]; then case "$POWERLEVEL9K_SHORTEN_STRATEGY" in - complete_directories) - current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c" + truncate_middle) + current_path=$(pwd | sed -e "s,^$HOME,~," | sed -E "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1\.\.\2\//g") ;; 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") + current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c" ;; esac -- cgit v1.2.3