1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prezto/modules/prompt/functions/prompt-pwd

33 lines
750 B

#
# Prompt setup function commonly used by prompt themes.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# function prompt-pwd {
setopt localoptions extendedglob
local current_pwd="${PWD/#$HOME/~}"
local ret_directory
if zstyle -m ':prezto:module:prompt' pwd-length 'full'; then
ret_directory=${PWD}
elif [[ "$current_pwd" == (#m)[/~] ]]; then
ret_directory="$MATCH"
unset MATCH
elif zstyle -m ':prezto:module:prompt' pwd-length 'long'; then
ret_directory=${current_pwd}
elif zstyle -m ':prezto:module:prompt' pwd-length 'tail'; then
ret_directory=${current_pwd:t}
else
ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}"
fi
unset current_pwd
print "$ret_directory"
# }