zimfw/modules/prompt/functions/short_pwd

11 lines
269 B
Plaintext
Raw Normal View History

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