2016-01-05 10:11:20 +01:00
|
|
|
# shortens the pwd for use in prompt
|
|
|
|
|
2016-03-25 22:37:00 +01:00
|
|
|
local current_dir="${1:-${PWD}}"
|
2016-01-05 10:11:20 +01:00
|
|
|
local return_dir='~'
|
|
|
|
|
2016-03-25 22:37:00 +01:00
|
|
|
current_dir="${current_dir/#${HOME}/~}"
|
|
|
|
|
2016-01-05 10:11:20 +01:00
|
|
|
# if we aren't in ~
|
|
|
|
if [[ ${current_dir} != '~' ]]; then
|
|
|
|
return_dir="${${${${(@j:/:M)${(@s:/:)current_dir}##.#?}:h}%/}//\%/%%}/${${current_dir:t}//\%/%%}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
print ${return_dir}
|