summaryrefslogtreecommitdiff
path: root/themes/fishy.zsh-theme
diff options
context:
space:
mode:
Diffstat (limited to 'themes/fishy.zsh-theme')
-rw-r--r--themes/fishy.zsh-theme18
1 files changed, 12 insertions, 6 deletions
diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme
index 00a60f45b..2b8d559e5 100644
--- a/themes/fishy.zsh-theme
+++ b/themes/fishy.zsh-theme
@@ -1,12 +1,18 @@
# ZSH Theme emulating the Fish shell's default prompt.
_fishy_collapsed_wd() {
- echo $(pwd | perl -pe '
- BEGIN {
- binmode STDIN, ":encoding(UTF-8)";
- binmode STDOUT, ":encoding(UTF-8)";
- }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g
-')
+ 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}"
}
local user_color='green'; [ $UID -eq 0 ] && user_color='red'