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
Cenk Gündoğan f1e697db6f [prompt] fix gitster path to reflect git repo
allow optional parameter for short_pwd

Closes #41
2016-07-19 00:23:49 -04:00

14 lines
315 B
Plaintext

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