Skip to content

Commit

Permalink
Merge remote branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludovic Rousseau committed Sep 7, 2012
2 parents fe4f983 + 8affd96 commit b78882a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions liquidprompt
Expand Up @@ -389,9 +389,8 @@ _lp_proxy()
# + keep some left part of the path if asked
_lp_shorten_path()
{
local p=$(echo "$1" | sed -e "s|$HOME|~|")
if [[ "$LP_ENABLE_SHORTEN_PATH" != 1 ]] ; then
echo "$p"
echo "$1"
return
fi
# the character that will replace the part of the path that is masked
Expand All @@ -404,6 +403,12 @@ _lp_shorten_path()

local len_percent=$2

local p
if [[ "$_LP_WORKING_SHELL" == "bash" ]]; then
p=$(echo "$1" | sed -e "s|$HOME|~|")
elif [[ "$_LP_WORKING_SHELL" == "zsh" ]]; then
p=$1
fi
local len="${#p}"

local max_len=$((${COLUMNS:-80}*$len_percent/100))
Expand Down Expand Up @@ -971,7 +976,11 @@ _lp_set_prompt()
LP_USER=$(_lp_user)
# LP_HOST is a global set at load time
LP_PERM=$(_lp_permissions_color)
LP_PWD=$(_lp_shorten_path "$PWD" $LP_PATH_LENGTH)
if [[ "$_LP_WORKING_SHELL" == "bash" ]]; then
LP_PWD=$(_lp_shorten_path "$PWD" $LP_PATH_LENGTH)
elif [[ "$_LP_WORKING_SHELL" == "zsh" ]]; then
LP_PWD=$(_lp_shorten_path "$(print -P "%~")" $LP_PATH_LENGTH)
fi
LP_PROXY="${LP_COLOR_PROXY}$(_lp_proxy)${NO_COL}"

# right of main prompt: space at left
Expand Down

0 comments on commit b78882a

Please sign in to comment.