diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2020-09-11 12:27:24 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2020-09-11 12:27:24 -0600 |
commit | 44cc53902935c693239611b06de02fc37ac4da62 (patch) | |
tree | 278cbbf8071e33776a3dfbfe484084136e6f791d /themes/fishy.zsh-theme | |
parent | 8620d4004c3391fa4f624ebf500eef8bcf32a52e (diff) | |
parent | 3667f94538c24ebaa9abd46e797a2610f3b67c5e (diff) | |
download | zsh-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-theme | 18 |
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' |