1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-11-14 22:21:13 +00:00
prezto/modules/prompt/functions/promptpwd
2017-04-13 01:16:44 -07:00

17 lines
410 B
Plaintext

# prompt setup function common to many prompts
# moved to external function to reduce code redundancy
setopt localoptions extendedglob
local current_pwd="${PWD/#$HOME/~}"
local ret_directory
if [[ "$current_pwd" == (#m)[/~] ]]; then
ret_directory="$MATCH"
unset MATCH
else
ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}"
fi
print "$ret_directory"