1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-13 17:30:08 +00:00

fishy: fix one-level directory bug and bad array assignment in zsh 5.0.1

This commit is contained in:
Marc Cornellà 2020-09-02 15:15:24 +02:00
parent a7f5170d68
commit 7256c03ce1

View file

@ -1,14 +1,17 @@
# ZSH Theme emulating the Fish shell's default prompt. # ZSH Theme emulating the Fish shell's default prompt.
_fishy_collapsed_wd() { _fishy_collapsed_wd() {
local -a pwd=("${(s:/:)PWD/#$HOME/~}") local i pwd
for i in {1..$(($#pwd-1))}; do pwd=("${(s:/:)PWD/#$HOME/~}")
if [[ "$pwd[$i]" = .* ]]; then if (( $#pwd > 1 )); then
pwd[$i]="${${pwd[$i]}[1,2]}" for i in {1..$(($#pwd-1))}; do
else if [[ "$pwd[$i]" = .* ]]; then
pwd[$i]="${${pwd[$i]}[1]}" pwd[$i]="${${pwd[$i]}[1,2]}"
fi else
done pwd[$i]="${${pwd[$i]}[1]}"
fi
done
fi
echo "${(j:/:)pwd}" echo "${(j:/:)pwd}"
} }