2017-07-21 02:08:19 +02:00
|
|
|
#
|
|
|
|
# Prompt setup function commonly used by prompt themes.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
2015-09-29 17:42:55 +02:00
|
|
|
|
2017-07-21 02:08:19 +02:00
|
|
|
# function prompt-pwd {
|
2017-07-07 01:01:26 +02:00
|
|
|
|
2017-04-13 10:16:44 +02:00
|
|
|
setopt localoptions extendedglob
|
|
|
|
|
2015-09-29 17:42:55 +02:00
|
|
|
local current_pwd="${PWD/#$HOME/~}"
|
|
|
|
local ret_directory
|
|
|
|
|
|
|
|
if [[ "$current_pwd" == (#m)[/~] ]]; then
|
|
|
|
ret_directory="$MATCH"
|
|
|
|
unset MATCH
|
2017-04-27 19:25:42 +02: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 18:07:34 +02:00
|
|
|
ret_directory=${current_pwd}
|
2015-09-29 17:42:55 +02:00
|
|
|
else
|
|
|
|
ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}"
|
|
|
|
fi
|
|
|
|
|
2017-07-21 02:08:19 +02:00
|
|
|
unset current_pwd
|
|
|
|
|
2015-09-29 17:42:55 +02:00
|
|
|
print "$ret_directory"
|
2017-07-07 01:01:26 +02:00
|
|
|
|
|
|
|
# }
|
2019-07-26 00:14:43 +02:00
|
|
|
# vim: ft=zsh
|