2015-09-29 15:42:55 +00:00
|
|
|
# prompt setup function common to many prompts
|
|
|
|
# moved to external function to reduce code redundancy
|
|
|
|
|
2017-07-06 23:01:26 +00:00
|
|
|
# function promptpwd {
|
|
|
|
|
2017-04-13 08:16:44 +00:00
|
|
|
setopt localoptions extendedglob
|
|
|
|
|
2015-09-29 15:42:55 +00:00
|
|
|
local current_pwd="${PWD/#$HOME/~}"
|
|
|
|
local ret_directory
|
|
|
|
|
|
|
|
if [[ "$current_pwd" == (#m)[/~] ]]; then
|
|
|
|
ret_directory="$MATCH"
|
|
|
|
unset MATCH
|
2017-04-27 17:25:42 +00:00
|
|
|
elif zstyle -m ':prezto:module:prompt' pwd-length 'full'; then
|
|
|
|
ret_directory=${PWD}
|
|
|
|
elif zstyle -m ':prezto:module:prompt' pwd-length 'long'; then
|
2017-04-26 16:07:34 +00:00
|
|
|
ret_directory=${current_pwd}
|
2015-09-29 15:42:55 +00:00
|
|
|
else
|
|
|
|
ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
print "$ret_directory"
|
2017-07-06 23:01:26 +00:00
|
|
|
|
|
|
|
# }
|