summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--themes/fishy.zsh-theme19
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}"
}