1
0
Fork 0
mirror of synced 2024-11-14 03:58:58 -05:00
zimfw/modules/prompt/functions/short_pwd

14 lines
315 B
Text
Raw Normal View History

2016-01-05 04:11:20 -05:00
# shortens the pwd for use in prompt
local current_dir="${1:-${PWD}}"
2016-01-05 04:11:20 -05:00
local return_dir='~'
current_dir="${current_dir/#${HOME}/~}"
2016-01-05 04:11:20 -05: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}