2643ac975bff9513753b6e3d99a34164e48955f7

Author
Nicholas Hutchinson <nshutchinson@gmail.com>
Committer
Nicholas Hutchinson <nshutchinson@gmail.com>
Date

Message

Update fishy theme to collapse working directory in PROMPT.

For non-trailing path components, we show only the first character. So, as in Fish proper, we convert ~/some/really/really/really/long/path/name to ~/s/r/r/r/l/p/name.

Diff

 1diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme
 2index f9e506cae77d27e5782b4479c4683082bdcf0da0..e9f78a54e426b92a457306049b578bc58b135aab 100644
 3--- a/themes/fishy.zsh-theme
 4+++ b/themes/fishy.zsh-theme
 5@@ -1,7 +1,11 @@
 6 # ZSH Theme emulating the Fish shell's default prompt.
 7 
 8+_fishy_collapsed_wd() {
 9+  echo $(pwd | perl -pe "s|^$HOME|~|g; s|/([^/])[^/]*(?=/)|/\$1|g")
10+}
11+
12 local user_color='green'; [ $UID -eq 0 ] && user_color='red'
13-PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) '
14+PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
15 PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
16 
17 local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"