Even better
This commit is contained in:
parent
12307ae0dc
commit
95327a4404
|
@ -48,10 +48,15 @@ fi
|
|||
truncated_pwd() {
|
||||
local max_allowed_size=$(( `tput cols` - 30 ))
|
||||
local path_name=$(print -rD $PWD)
|
||||
local new_path_name=""
|
||||
local truncated=0
|
||||
while [ ${#path_name} -gt $max_allowed_size ]; do
|
||||
truncated=1
|
||||
path_name=`echo $path_name | cut -d '/' -f 2-`
|
||||
new_path_name=`echo $path_name | cut -d '/' -f 2-`
|
||||
if [[ "$new_path_name" == "$path_name" ]]; then
|
||||
break
|
||||
fi
|
||||
path_name=$new_path_name
|
||||
done
|
||||
if [ $truncated -eq 1 ]; then
|
||||
echo "~/.../"$path_name
|
||||
|
|
Loading…
Reference in New Issue