zim/modules/prompt/functions/short_pwd
Eric Nielsen c9d1be395d [prompt] Simplify short_pwd function
We don't need a second variable.
2018-09-13 10:10:49 -05:00

10 lines
269 B
Text

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