2e3731c5b1f0070a076fa84e9e2c35975a962ee5
Author Danyil Bohdan <danyil.bohdan@gmail.com> Committer Danyil Bohdan <danyil.bohdan@gmail.com> Date 2015-12-04 18:19 UTC
Message "fishy" theme: Shorten path .foo to .f, not .
When the current path is /home/user/.config/doublecmd the prompt
now reads "/h/u/.c/doublecmd", not "/h/u/./doublecmd" as was the
case. This matches what the Fish shell does.
Enclose the Perl snippet in single quotes instead of double quotes.
Diff 1 diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme
2 index 8b24172a2e742494de54c28b19f781abd756eb87..5937592dc7ace5d2ec9d0650a819a73f752e8afa 100644
3 --- a/themes/fishy.zsh-theme
4 +++ b/themes/fishy.zsh-theme
5 @@ -1,13 +1,13 @@
6 # ZSH Theme emulating the Fish shell's default prompt.
7
8 _fishy_collapsed_wd() {
9 - echo $(pwd | perl -pe "
10 + echo $(pwd | perl -pe '
11 BEGIN {
12 - binmode STDIN, ':encoding(UTF-8)';
13 - binmode STDOUT, ':encoding(UTF-8)';
14 - }; s|^$HOME|~|g; s|/([^/])[^/]*(?=/)|/\$1|g
15 -")
16 -}
17 + binmode STDIN, ":encoding(UTF-8)";
18 + binmode STDOUT, ":encoding(UTF-8)";
19 + }; s|^$HOME|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g;
20 +')
21 +}
22
23 local user_color='green'; [ $UID -eq 0 ] && user_color='red'
24 PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '