diff options
author | Marc Cornellà <marc.cornella@live.com> | 2020-09-02 15:15:24 +0200 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2020-09-02 15:15:24 +0200 |
commit | 7256c03ce1c54bd08ecab954c91a0231386556a6 (patch) | |
tree | 3c57099e8ba4c4129800de52b916b338b6a6e7e6 /themes/fishy.zsh-theme | |
parent | a7f5170d68c0b75a9864763a90ac11e51ec67c81 (diff) | |
download | zsh-7256c03ce1c54bd08ecab954c91a0231386556a6.tar.gz zsh-7256c03ce1c54bd08ecab954c91a0231386556a6.tar.bz2 zsh-7256c03ce1c54bd08ecab954c91a0231386556a6.zip |
fishy: fix one-level directory bug and bad array assignment in zsh 5.0.1
Diffstat (limited to 'themes/fishy.zsh-theme')
-rw-r--r-- | themes/fishy.zsh-theme | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index f6dae6181..2b8d559e5 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -1,14 +1,17 @@ # ZSH Theme emulating the Fish shell's default prompt. _fishy_collapsed_wd() { - local -a pwd=("${(s:/:)PWD/#$HOME/~}") - for i in {1..$(($#pwd-1))}; do - if [[ "$pwd[$i]" = .* ]]; then - pwd[$i]="${${pwd[$i]}[1,2]}" - else - pwd[$i]="${${pwd[$i]}[1]}" - fi - done + local i pwd + pwd=("${(s:/:)PWD/#$HOME/~}") + if (( $#pwd > 1 )); then + for i in {1..$(($#pwd-1))}; do + if [[ "$pwd[$i]" = .* ]]; then + pwd[$i]="${${pwd[$i]}[1,2]}" + else + pwd[$i]="${${pwd[$i]}[1]}" + fi + done + fi echo "${(j:/:)pwd}" } |