1
0
Fork 0
mirror of synced 2024-05-27 12:31:12 -04:00
zimfw/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

11 lines
269 B
Plaintext

# 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}