Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to pwd-length handling #1476

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions modules/prompt/functions/prompt-pwd
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ setopt localoptions extendedglob
local current_pwd="${PWD/#$HOME/~}"
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be the last branch before the else to avoid using this for other explicit options as well?

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}
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
Expand Down