summaryrefslogtreecommitdiff
path: root/themes/dieter.zsh-theme
diff options
context:
space:
mode:
authorNanoTech <nanotech008@gmail.com>2011-02-05 23:51:05 -0600
committerNanoTech <nanotech008@gmail.com>2011-02-05 23:51:05 -0600
commit143dd165e973a3559fbc1b085f1ff05e263f85b0 (patch)
tree25aa67cf40f468d658ec6f37657e8efa3c128ef8 /themes/dieter.zsh-theme
parent2a203b558fd6328c9a91e9dbbf145d91e7ba7ed1 (diff)
parent01b0366f3e27cf30f3882870100f14625fc267d1 (diff)
downloadzsh-143dd165e973a3559fbc1b085f1ff05e263f85b0.tar.gz
zsh-143dd165e973a3559fbc1b085f1ff05e263f85b0.tar.bz2
zsh-143dd165e973a3559fbc1b085f1ff05e263f85b0.zip
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'themes/dieter.zsh-theme')
-rw-r--r--themes/dieter.zsh-theme56
1 files changed, 56 insertions, 0 deletions
diff --git a/themes/dieter.zsh-theme b/themes/dieter.zsh-theme
new file mode 100644
index 000000000..0a5e9265b
--- /dev/null
+++ b/themes/dieter.zsh-theme
@@ -0,0 +1,56 @@
+# the idea of this theme is to contain a lot of info in a small string, by
+# compressing some parts and colorcoding, which bring useful visual cues,
+# while limiting the amount of colors and such to keep it easy on the eyes.
+# When a command exited >0, the timestamp will be in red and the exit code
+# will be on the right edge.
+# The exit code visual cues will only display once.
+# (i.e. they will be reset, even if you hit enter a few times on empty command prompts)
+
+typeset -A host_repr
+
+# translate hostnames into shortened, colorcoded strings
+host_repr=('dieter-ws-a7n8x-arch' "%{$fg_bold[green]%}ws" 'dieter-p4sci-arch' "%{$fg_bold[blue]%}p4")
+
+# local time, color coded by last return code
+time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
+time_disabled="%{$fg[green]%}%*%{$reset_color%}"
+time=$time_enabled
+
+# user part, color coded by privileges
+local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}"
+
+# Hostname part. compressed and colorcoded per host_repr array
+# if not found, regular hostname in default color
+local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}"
+
+# Compacted $PWD
+local pwd="%{$fg[blue]%}%c%{$reset_color%}"
+
+PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)'
+
+# i would prefer 1 icon that shows the "most drastic" deviation from HEAD,
+# but lets see how this works out
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}?%{$fg[green]%}%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}"
+
+# elaborate exitcode on the right when >0
+return_code_enabled="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
+return_code_disabled=
+return_code=$return_code_enabled
+
+RPS1='${return_code}'
+
+function accept-line-or-clear-warning () {
+ if [[ -z $BUFFER ]]; then
+ time=$time_disabled
+ return_code=$return_code_disabled
+ else
+ time=$time_enabled
+ return_code=$return_code_enabled
+ fi
+ zle accept-line
+}
+zle -N accept-line-or-clear-warning
+bindkey '^M' accept-line-or-clear-warning