summaryrefslogtreecommitdiff
path: root/themes/fishy.zsh-theme
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2020-09-11 12:27:24 -0600
committerTuowen Zhao <ztuowen@gmail.com>2020-09-11 12:27:24 -0600
commit44cc53902935c693239611b06de02fc37ac4da62 (patch)
tree278cbbf8071e33776a3dfbfe484084136e6f791d /themes/fishy.zsh-theme
parent8620d4004c3391fa4f624ebf500eef8bcf32a52e (diff)
parent3667f94538c24ebaa9abd46e797a2610f3b67c5e (diff)
downloadzsh-44cc53902935c693239611b06de02fc37ac4da62.tar.gz
zsh-44cc53902935c693239611b06de02fc37ac4da62.tar.bz2
zsh-44cc53902935c693239611b06de02fc37ac4da62.zip
Merge remote-tracking branch 'origin/master' into master
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'