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