]> arthur.barton.de Git - OhMyZshExtensions.git/blob - alex.zsh-theme
Add "thefuck" plugin: Alias "fuck" to the "thefuck" command
[OhMyZshExtensions.git] / alex.zsh-theme
1 # Alex "oh my ZSH" theme
2 # Based on the "Sunrise" theme, thanks!
3 # 2015-05-05, alex@barton.de
4
5 # Color shortcuts; %B sets bold text
6 B=$fg_no_bold[blue]
7 C=$fg_no_bold[cyan]
8 G=$fg_no_bold[green]
9 M=$fg_no_bold[magenta]
10 R=$fg_no_bold[red]
11 Y=$fg_no_bold[yellow]
12 RESET=$reset_color
13
14 [ "$UID" -eq 0 ] \
15         && PREFIX="%B%{$R%}-!-%{$RESET%} " \
16         || PREFIX=""
17
18 ZSH_THEME_GIT_PROMPT_PREFIX="(%{$Y%}"
19 ZSH_THEME_GIT_PROMPT_SUFFIX="%{$RESET%}) "
20
21 ZSH_THEME_GIT_PROMPT_CLEAN="%{$G%}✔"
22 ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}✘"
23 ZSH_THEME_GIT_PROMPT_AHEAD="%{$C%}➔"
24
25 function custom_git_prompt() {
26         ref=$(git symbolic-ref HEAD 2> /dev/null) || return
27         echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/} $(parse_git_dirty)$(git_prompt_ahead)$ZSH_THEME_GIT_PROMPT_SUFFIX"
28 }
29
30 ZSH_THEME_HOSTNAME_PROMPT_PREFIX=""
31 ZSH_THEME_HOSTNAME_PROMPT_SUFFIX="%{$RESET%}:"
32
33 function custom_hostname_prompt() {
34         [ -z "$SSH_CLIENT" ] && return
35         echo "$ZSH_THEME_HOSTNAME_PROMPT_PREFIX$(hostname -s)$ZSH_THEME_HOSTNAME_PROMPT_SUFFIX"
36 }
37
38 local return_code="%(?..%{$R%}%? ↵%{$RESET%})"
39
40 PROMPT='$(custom_hostname_prompt)%B%2~%b $(custom_git_prompt)%{$G%}%B$%b%{$RESET%} '
41 RPS1="${return_code}"
42
43 unset LSCOLORS