Changed the default behaviour to truncate whole directories.

pull/22/head
Dominik Ritter 9 years ago
parent 9efe519dc5
commit 754b648f37

@ -279,11 +279,11 @@ to a certain length:
To change the way how the current working directory is truncated, just set: To change the way how the current working directory is truncated, just set:
# truncate whole directories # truncate the middle part
POWERLEVEL9K_SHORTEN_STRATEGY="complete_directories" POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle"
# truncate from right, leaving the first X characters untouched # truncate from right, leaving the first X characters untouched
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right" 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 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 to. So in some cases `POWERLEVEL9K_SHORTEN_DIR_LENGTH` means characters, in

@ -484,14 +484,14 @@ prompt_dir() {
if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" ]]; then if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" ]]; then
case "$POWERLEVEL9K_SHORTEN_STRATEGY" in case "$POWERLEVEL9K_SHORTEN_STRATEGY" in
complete_directories) truncate_middle)
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c" current_path=$(pwd | sed -e "s,^$HOME,~," | sed -E "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1\.\.\2\//g")
;; ;;
truncate_from_right) 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})[^/]+\//\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 esac

Loading…
Cancel
Save