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%})"
|
||||
truncated_pwd() {
|
||||
current_pwd=$(print -rD $PWD)
|
||||
if [ ${#current_pwd} -gt 50 ]; then
|
||||
last_dirs=`echo ${current_pwd: -50} | cut -d '/' -f 2-`
|
||||
echo "~/.../${last_dirs}"
|
||||
local max_allowed_size=$(( `tput cols` - 30 ))
|
||||
local path_name=$(print -rD $PWD)
|
||||
local truncated=0
|
||||
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
|
||||
echo $current_pwd
|
||||
echo $path_name
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue