I'm fucking awesome
This commit is contained in:
parent
93ad9c6df3
commit
12307ae0dc
|
@ -46,12 +46,17 @@ fi
|
||||||
|
|
||||||
# local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
|
# local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
|
||||||
truncated_pwd() {
|
truncated_pwd() {
|
||||||
current_pwd=$(print -rD $PWD)
|
local max_allowed_size=$(( `tput cols` - 30 ))
|
||||||
if [ ${#current_pwd} -gt 50 ]; then
|
local path_name=$(print -rD $PWD)
|
||||||
last_dirs=`echo ${current_pwd: -50} | cut -d '/' -f 2-`
|
local truncated=0
|
||||||
echo "~/.../${last_dirs}"
|
while [ ${#path_name} -gt $max_allowed_size ]; do
|
||||||
|
truncated=1
|
||||||
|
path_name=`echo $path_name | cut -d '/' -f 2-`
|
||||||
|
done
|
||||||
|
if [ $truncated -eq 1 ]; then
|
||||||
|
echo "~/.../"$path_name
|
||||||
else
|
else
|
||||||
echo $current_pwd
|
echo $path_name
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue