This repository has been archived on 2020-09-21. You can view files and clone it, but cannot push or open issues or pull requests.
zim/modules/prompt/functions/short_pwd

12 lines
279 B
Plaintext
Raw Normal View History

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