81eec406c8186a8f15763cf21230e0f1164942c9
- Author
- Michele Bologna <michele.bologna@gmail.com>
- Committer
- ncanceill <nicolas.canceill@ens-cachan.org>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme
2index a7599c8f52ce077e2b4aa7dd223f86a528cec1f4..fec2438734af2f0fcd5a03bd882ffce52598e471 100644
3--- a/themes/michelebologna.zsh-theme
4+++ b/themes/michelebologna.zsh-theme
5@@ -1,44 +1,74 @@
6-# reference colors
7-GREEN="%{$fg_bold[green]%}"
8-RED="%{$fg_bold[red]%}"
9-CYAN="%{$fg_bold[cyan]%}"
10-YELLOW="%{$fg_bold[yellow]%}"
11-BLUE="%{$fg_bold[blue]%}"
12-MAGENTA="%{$fg_bold[magenta]%}"
13-WHITE="%{$fg_bold[white]%}"
14-
15-COLOR_ARRAY=($GREEN $RED $CYAN $YELLOW $BLUE $MAGENTA $WHITE)
16-
17-# color reset
18-RESET_COLOR="%{$reset_color%}"
19-
20-# which color should be applied?
21-USERNAME_NORMAL_COLOR=$WHITE
22-USERNAME_ROOT_COLOR=$RED
23-HOSTNAME_NORMAL_COLOR=$BLUE
24-# uncomment next line if you want auto-generated hostname color
25-#for i in $HOST; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
26-HOSTNAME_ROOT_COLOR=$RED
27-HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR)
28-CURRENT_DIR_COLOR=$CYAN
29-
30-# zsh commands
31-USERNAME_COMMAND="%n"
32-HOSTNAME_COMMAND="%m"
33-CURRENT_DIR="%~"
34-
35-# output: colors + commands
36-USERNAME_OUTPUT="%(!..$USERNAME_NORMAL_COLOR$USERNAME_COMMAND$RESET_COLOR@)"
37-HOSTNAME_OUTPUT="$HOSTNAME_COLOR$HOSTNAME_COMMAND$RESET_COLOR"
38-CURRENT_DIR_OUTPUT="$CURRENT_DIR_COLOR$CURRENT_DIR"
39-LAST_COMMAND_OUTPUT="%(?.%(!.$RED.$GREEN).$YELLOW)"
40-
41-# git theming
42-ZSH_THEME_GIT_PROMPT_PREFIX="("
43+# Michele Bologna's theme
44+# http://michelebologna.net
45+#
46+# This a theme for oh-my-zsh. Features a colored prompt with:
47+# * username@host: [jobs] [git] workdir %
48+# * hostname color is based on hostname characters. When using as root, the
49+# prompt shows only the hostname in red color.
50+# * [jobs], if applicable, counts the number of suspended jobs tty
51+# * [git], if applicable, represents the status of your git repo (more on that
52+# later)
53+# * '%' prompt will be green if last command return value is 0, yellow otherwise.
54+#
55+# git prompt is inspired by official git contrib prompt:
56+# https://github.com/git/git/tree/master/contrib/completion/git-prompt.sh
57+# and it adds:
58+# * the current branch
59+# * '%' if there are untracked files
60+# * '$' if there are stashed changes
61+# * '*' if there are modified files
62+# * '+' if there are added files
63+# * '<' if local repo is behind remote repo
64+# * '>' if local repo is ahead remote repo
65+# * '=' if local repo is equal to remote repo (in sync)
66+# * '<>' if local repo is diverged
67+
68+local green="%{$fg_bold[green]%}"
69+local red="%{$fg_bold[red]%}"
70+local cyan="%{$fg_bold[cyan]%}"
71+local yellow="%{$fg_bold[yellow]%}"
72+local blue="%{$fg_bold[blue]%}"
73+local magenta="%{$fg_bold[magenta]%}"
74+local white="%{$fg_bold[white]%}"
75+local reset="%{$reset_color%}"
76+
77+local -a color_array
78+color_array=($green $red $cyan $yellow $blue $magenta $white)
79+
80+local username_normal_color=$white
81+local username_root_color=$red
82+local hostname_root_color=$red
83+
84+# calculating hostname color with hostname characters
85+for i in `hostname`; local hostname_normal_color=$color_array[$[((#i))%7+1]]
86+local -a hostname_color
87+hostname_color=%(!.$hostname_root_color.$hostname_normal_color)
88+
89+local current_dir_color=$blue
90+local username_command="%n"
91+local hostname_command="%m"
92+local current_dir="%~"
93+
94+local username_output="%(!..$username_normal_color$username_command$reset@)"
95+local hostname_output="$hostname_color$hostname_command$reset"
96+local current_dir_output="$current_dir_color$current_dir$reset"
97+local jobs_bg="${red}fg: %j$reset"
98+local last_command_output="%(?.%(!.$red.$green).$yellow)"
99+
100+ZSH_THEME_GIT_PROMPT_PREFIX=""
101 ZSH_THEME_GIT_PROMPT_SUFFIX=""
102-ZSH_THEME_GIT_PROMPT_DIRTY=")$RED*"
103-ZSH_THEME_GIT_PROMPT_CLEAN=")"
104+ZSH_THEME_GIT_PROMPT_DIRTY=""