7256c03ce1c54bd08ecab954c91a0231386556a6

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

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

Diff

 1diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme
 2index f6dae61818022742de53528c38bd7111919252bb..2b8d559e5e64b72aaf335997497730acd1afdf91 100644
 3--- a/themes/fishy.zsh-theme
 4+++ b/themes/fishy.zsh-theme
 5@@ -1,14 +1,17 @@
 6 # ZSH Theme emulating the Fish shell's default prompt.
 7 
 8 _fishy_collapsed_wd() {
 9-  local -a pwd=("${(s:/:)PWD/#$HOME/~}")
10-  for i in {1..$(($#pwd-1))}; do
11-    if [[ "$pwd[$i]" = .* ]]; then
12-      pwd[$i]="${${pwd[$i]}[1,2]}"
13-    else
14-      pwd[$i]="${${pwd[$i]}[1]}"
15-    fi
16-  done
17+  local i pwd
18+  pwd=("${(s:/:)PWD/#$HOME/~}")
19+  if (( $#pwd > 1 )); then
20+    for i in {1..$(($#pwd-1))}; do
21+      if [[ "$pwd[$i]" = .* ]]; then
22+        pwd[$i]="${${pwd[$i]}[1,2]}"
23+      else
24+        pwd[$i]="${${pwd[$i]}[1]}"
25+      fi
26+    done
27+  fi
28   echo "${(j:/:)pwd}"
29 }
30