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