diff options
author | Marc Cornellà <marc.cornella@live.com> | 2020-08-31 17:38:30 +0200 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2020-09-01 11:52:32 +0200 |
commit | a7f5170d68c0b75a9864763a90ac11e51ec67c81 (patch) | |
tree | 40b69169c39ba21f3be731cff9b317aeacf3c8fd /themes | |
parent | 0dc83fe49fa1f645c64fe7dbdb94914093b90aff (diff) | |
download | zsh-a7f5170d68c0b75a9864763a90ac11e51ec67c81.tar.gz zsh-a7f5170d68c0b75a9864763a90ac11e51ec67c81.tar.bz2 zsh-a7f5170d68c0b75a9864763a90ac11e51ec67c81.zip |
Remove perl dependency
Diffstat (limited to 'themes')
-rw-r--r-- | themes/fishy.zsh-theme | 15 | ||||
-rw-r--r-- | themes/trapd00r.zsh-theme | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index 00a60f45b..f6dae6181 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -1,12 +1,15 @@ # 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 -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 + echo "${(j:/:)pwd}" } local user_color='green'; [ $UID -eq 0 ] && user_color='red' diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme index 7a589a699..4e3238393 100644 --- a/themes/trapd00r.zsh-theme +++ b/themes/trapd00r.zsh-theme @@ -2,7 +2,7 @@ # # This theme needs a terminal supporting 256 colors as well as unicode. # In order to avoid external dependencies, it also has a zsh version of -# the perl script at https://github.com/trapd00r/utils/blob/master/zsh_path, +# the previously used perl script https://github.com/trapd00r/utils/blob/master/zsh_path, # which splits up the current path and makes it fancy. # # By default it spans over two lines like so: |