PYENV prompt.
[profile.git] / .profile.d / ps1.bashrc
index 80ad1da..7c4cf2c 100644 (file)
@@ -238,7 +238,7 @@ function __ps1_short() {
   local pwd=${PWD/#$home/\~}
   local dirtrim=${PROMPT_DIRTRIM//[^0-9]/}
 
-  if [ "${dirtrim:0:1}" = "0" ]; then
+  if [ "${dirtrim:0:1}" = "0" -o "$PWD" = "$HOME" ]; then
     echo "$pwd"
     return $1
   fi
@@ -265,7 +265,7 @@ function __ps1_short() {
   local n=1
   local short=
   for component in $reversed; do
-    [ $n = 1 -a "$PWD" = "$pwd" ] || short="/$short"
+    [ $n = 1 ] || short="/$short"
     if [ $n -ge $dirtrim ]; then
       short="${component:0:1}$short"
     else
@@ -274,7 +274,7 @@ function __ps1_short() {
     n=$((n+1))
   done
 
-  [ "${short:0:1}" = "~" ] || short="/$short"
+  [ "${short:0:1}" = "~" -o -z "$basename" ] || short="/$short"
   echo "$short/$dirname"
   return $1
 }