fishy.zsh-theme 1.3 KB

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