fishy.zsh-theme 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
  18. PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
  19. local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
  20. RPROMPT="${RPROMPT}"'${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}'
  21. ZSH_THEME_GIT_PROMPT_PREFIX=" "
  22. ZSH_THEME_GIT_PROMPT_SUFFIX=""
  23. ZSH_THEME_GIT_PROMPT_DIRTY=""
  24. ZSH_THEME_GIT_PROMPT_CLEAN=""
  25. ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+"
  26. ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!"
  27. ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-"
  28. ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>"
  29. ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#"
  30. ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?"