fishy.zsh-theme
1284 bytes
1# ZSH Theme emulating the Fish shell's default prompt.
2
3_fishy_collapsed_wd() {
4 local i pwd
5 pwd=("${(s:/:)PWD/#$HOME/~}")
6 if (( $#pwd > 1 )); then
7 for i in {1..$(($#pwd-1))}; do
8 if [[ "$pwd[$i]" = .* ]]; then
9 pwd[$i]="${${pwd[$i]}[1,2]}"
10 else
11 pwd[$i]="${${pwd[$i]}[1]}"
12 fi
13 done
14 fi
15 echo "${(j:/:)pwd}"
16}
17
18local user_color='green'; [ $UID -eq 0 ] && user_color='red'
19local host_color='white'; [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && host_color='yellow'
20PROMPT='%{$fg[$user_color]%}%n%{$reset_color%}@%{$fg[$host_color]%}%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
21PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
22
23local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
24RPROMPT="${RPROMPT}"'${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}'
25
26ZSH_THEME_GIT_PROMPT_PREFIX=" "
27ZSH_THEME_GIT_PROMPT_SUFFIX=""
28ZSH_THEME_GIT_PROMPT_DIRTY=""
29ZSH_THEME_GIT_PROMPT_CLEAN=""
30
31ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+"
32ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!"
33ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-"
34ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>"
35ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#"
36ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?"