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