oh-my-zsh avit theme: instead of only showing the last 3 directories in the $PWD shorten the path by removing some middle parts if $PWD becomes too long.
Diff
1diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme
2index fc6b004557bc7043bc20039aa2922dd0a1b1be1d..b5a05799eb18d2d3ba0750fe76c6a004861aff27 100644
3--- a/themes/avit.zsh-theme
4+++ b/themes/avit.zsh-theme
5@@ -1,17 +1,25 @@
6 # AVIT ZSH Theme
7 8 PROMPT='
9-$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version)
10+$(_user_host)$(_current_dir) $(git_prompt_info) $(_ruby_version)
11 %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} '
1213 PROMPT2='%{$fg[grey]%}◀%{$reset_color%} '
1415 RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
1617-local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} "
18 local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}"
19 local _hist_no="%{$fg[grey]%}%h%{$reset_color%}"
2021+function _current_dir() {
22+ local _max_pwd_length="65"
23+ if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then
24+ echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} "
25+ else
26+ echo "%{$fg_bold[blue]%}%~%{$reset_color%} "
27+ fi
28+}
29+
30 function _user_host() {
31 if [[ -n $SSH_CONNECTION ]]; then
32 me="%n@%m"