1
0
Fork 0
mirror of synced 2024-10-02 07:26:55 -04:00
zimfw/modules/prompt/functions/short_pwd
2016-03-25 22:36:34 +01:00

13 lines
315 B
Text

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