1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-14 00:50:08 +00:00

Merge pull request #300 from andjscott/prompt_dir_shortening

Handle spaces in path when shortening
This commit is contained in:
Ben Hilburn 2016-08-30 17:40:31 -04:00 committed by GitHub
commit 02820a9f3f

View file

@ -466,7 +466,7 @@ prompt_dir() {
current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g") current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g")
;; ;;
truncate_from_right) truncate_from_right)
current_path=$(truncatePathFromRight $(pwd | sed -e "s,^$HOME,~,") ) current_path=$(truncatePathFromRight "$(pwd | sed -e "s,^$HOME,~,")" )
;; ;;
truncate_with_package_name) truncate_with_package_name)
local name repo_path package_path current_dir zero local name repo_path package_path current_dir zero
@ -493,7 +493,7 @@ prompt_dir() {
# from the package.json and append the current subdirectory # from the package.json and append the current subdirectory
current_path="`echo $name | tr -d '"'`$subdirectory_path" current_path="`echo $name | tr -d '"'`$subdirectory_path"
else else
current_path=$(truncatePathFromRight $(pwd | sed -e "s,^$HOME,~,") ) current_path=$(truncatePathFromRight "$(pwd | sed -e "s,^$HOME,~,")" )
fi fi
;; ;;
*) *)