Ensure 'full' pwd-length always expands '~'

Prompt-pwd's 'full' option always expands '~', as opposed to only
expanding when '~' would be followed by other directories.
This means the path is always in a consistent format, rather than
alternating between expanded and condensed.
This commit is contained in:
Zoey Llewellyn Hewll 2017-10-01 12:02:36 +08:00
parent 1d0bee6098
commit b3a2a7bfeb

View File

@ -12,11 +12,11 @@ setopt localoptions extendedglob
local current_pwd="${PWD/#$HOME/~}" local current_pwd="${PWD/#$HOME/~}"
local ret_directory local ret_directory
if [[ "$current_pwd" == (#m)[/~] ]]; then if zstyle -m ':prezto:module:prompt' pwd-length 'full'; then
ret_directory=${PWD}
elif [[ "$current_pwd" == (#m)[/~] ]]; then
ret_directory="$MATCH" ret_directory="$MATCH"
unset 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 elif zstyle -m ':prezto:module:prompt' pwd-length 'long'; then
ret_directory=${current_pwd} ret_directory=${current_pwd}
else else