1
0
Fork 0
mirror of synced 2024-11-26 17:25:35 -05:00

[prompt] add short_pwd func

This commit is contained in:
Matt Hamilton 2016-01-05 04:11:20 -05:00
parent bf10ce72c5
commit 69b194302c

View file

@ -0,0 +1,11 @@
# 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}