fishy.zsh-theme 1.0 KB

1234567891011121314151617181920212223242526272829
  1. # ZSH Theme emulating the Fish shell's default prompt.
  2. _fishy_collapsed_wd() {
  3. echo $(pwd | perl -pe '
  4. BEGIN {
  5. binmode STDIN, ":encoding(UTF-8)";
  6. binmode STDOUT, ":encoding(UTF-8)";
  7. }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g
  8. ')
  9. }
  10. local user_color='green'; [ $UID -eq 0 ] && user_color='red'
  11. PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
  12. PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
  13. local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
  14. RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}'
  15. ZSH_THEME_GIT_PROMPT_PREFIX=" "
  16. ZSH_THEME_GIT_PROMPT_SUFFIX=""
  17. ZSH_THEME_GIT_PROMPT_DIRTY=""
  18. ZSH_THEME_GIT_PROMPT_CLEAN=""
  19. ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+"
  20. ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!"
  21. ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-"
  22. ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>"
  23. ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#"
  24. ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?"