Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 57 lines (45 sloc) 2.056 kb
0cd956c @Dieterbe better phrasing/documentation
Dieterbe authored
1 # the idea of this theme is to contain a lot of info in a small string, by
2 # compressing some parts and colorcoding, which bring useful visual cues,
3 # while limiting the amount of colors and such to keep it easy on the eyes.
4 # When a command exited >0, the timestamp will be in red and the exit code
5 # will be on the right edge.
6 # The exit code visual cues will only display once.
dc87b81 @Dieterbe reset exit code visual cues (not exit code itself) after showing once
Dieterbe authored
7 # (i.e. they will be reset, even if you hit enter a few times on empty command prompts)
e5beb1a @Dieterbe add dieter theme v1
Dieterbe authored
8
9 typeset -A host_repr
10
0cd956c @Dieterbe better phrasing/documentation
Dieterbe authored
11 # translate hostnames into shortened, colorcoded strings
12 host_repr=('dieter-ws-a7n8x-arch' "%{$fg_bold[green]%}ws" 'dieter-p4sci-arch' "%{$fg_bold[blue]%}p4")
e5beb1a @Dieterbe add dieter theme v1
Dieterbe authored
13
0cd956c @Dieterbe better phrasing/documentation
Dieterbe authored
14 # local time, color coded by last return code
dc87b81 @Dieterbe reset exit code visual cues (not exit code itself) after showing once
Dieterbe authored
15 time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
16 time_disabled="%{$fg[green]%}%*%{$reset_color%}"
17 time=$time_enabled
18
0cd956c @Dieterbe better phrasing/documentation
Dieterbe authored
19 # user part, color coded by privileges
e5beb1a @Dieterbe add dieter theme v1
Dieterbe authored
20 local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}"
dc87b81 @Dieterbe reset exit code visual cues (not exit code itself) after showing once
Dieterbe authored
21
e5beb1a @Dieterbe add dieter theme v1
Dieterbe authored
22 # Hostname part. compressed and colorcoded per host_repr array
23 # if not found, regular hostname in default color
24 local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}"
dc87b81 @Dieterbe reset exit code visual cues (not exit code itself) after showing once
Dieterbe authored
25
e5beb1a @Dieterbe add dieter theme v1
Dieterbe authored
26 # Compacted $PWD
27 local pwd="%{$fg[blue]%}%c%{$reset_color%}"
28
29 PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)'
30
0cd956c @Dieterbe better phrasing/documentation
Dieterbe authored
31 # i would prefer 1 icon that shows the "most drastic" deviation from HEAD,
32 # but lets see how this works out
e5beb1a @Dieterbe add dieter theme v1
Dieterbe authored
33 ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"
34 ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
35 ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}?%{$fg[green]%}%{$reset_color%}"
36 ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}"
37
38 # elaborate exitcode on the right when >0
dc87b81 @Dieterbe reset exit code visual cues (not exit code itself) after showing once
Dieterbe authored
39 return_code_enabled="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
40 return_code_disabled=
41 return_code=$return_code_enabled
42
43 RPS1='${return_code}'
44
45 function accept-line-or-clear-warning () {
46 if [[ -z $BUFFER ]]; then
47 time=$time_disabled
48 return_code=$return_code_disabled
49 else
50 time=$time_enabled
51 return_code=$return_code_enabled
52 fi
53 zle accept-line
54 }
55 zle -N accept-line-or-clear-warning
56 bindkey '^M' accept-line-or-clear-warning
Something went wrong with that request. Please try again.