mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-23 04:28:00 +00:00
25 lines
619 B
Plaintext
25 lines
619 B
Plaintext
# prompt setup function common to many prompts
|
|
# moved to external function to reduce code redundancy
|
|
|
|
# function promptpwd {
|
|
|
|
setopt localoptions extendedglob
|
|
|
|
local current_pwd="${PWD/#$HOME/~}"
|
|
local ret_directory
|
|
|
|
if [[ "$current_pwd" == (#m)[/~] ]]; then
|
|
ret_directory="$MATCH"
|
|
unset MATCH
|
|
elif zstyle -m ':prezto:module:prompt' pwd-length 'full'; then
|
|
ret_directory=${PWD}
|
|
elif zstyle -m ':prezto:module:prompt' pwd-length 'long'; then
|
|
ret_directory=${current_pwd}
|
|
else
|
|
ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}"
|
|
fi
|
|
|
|
print "$ret_directory"
|
|
|
|
# }
|