-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathodie.zsh-theme
112 lines (91 loc) · 2.17 KB
/
odie.zsh-theme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# general stuff
function _echo() {
# echo without trailing newline
str=$1
echo -n "${str}"
}
function _colorize() {
# echo a string with a color
str=$1
color=${2:-default}
_echo "%{${fg[${color}]}%}${prefix}${str}${suffix}%{${reset_color}%}"
}
# left prompt
function _user() {
# echo the user name in red if the user is root or green for everyone else
user="%n"
if [[ $UID == 0 ]]; then
color="red"
else
color="green"
fi
_colorize "${user}" "${color}"
}
function _host() {
# echo hostname
host="%m "
color="cyan"
_colorize "${host}" "${color}"
}
function _user_at_host() {
_user
_colorize "@"
_host
}
function _directory() {
# echo current working directory
directory="%1~ "
color="yellow"
_colorize "${directory}" "${color}"
}
function _exit_status() {
# echo a symbol in red or green depending on the exit status of the last run command
exit_status=" "
exit_status="%(0?.%{$fg[green]%}.%{$fg[red]%})$exit_status%{$reset_color%}"
_echo "${exit_status}"
}
function _build_prompt() {
_user_at_host
_directory
_exit_status
}
# right prompt
function _git_branch() {
# echo git branch info
color="green"
_colorize ' $(git_prompt_info)' "${color}"
}
function _git_status() {
# echo git branch info
_echo ' $(git_prompt_status)'
}
function _virtualenv() {
# echo python virtualenv info
_colorize ' $(virtualenv_prompt_info)' "yellow"
}
function _vi_mode() {
# echo vi mode info
_echo ' $(vi_mode_prompt_info)'
}
function _build_rprompt() {
_git_status
_git_branch
_virtualenv
_vi_mode
}
# build prompt
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_ADDED="$(_colorize " ✚" "green")"
ZSH_THEME_GIT_PROMPT_MODIFIED="$(_colorize " ✹" "blue")"
ZSH_THEME_GIT_PROMPT_DELETED="$(_colorize " ✖" "red")"
ZSH_THEME_GIT_PROMPT_RENAMED="$(_colorize " ➜" "magenta")"
ZSH_THEME_GIT_PROMPT_UNMERGED="$(_colorize " ═" "yellow")"
ZSH_THEME_GIT_PROMPT_UNTRACKED="$(_colorize " ✭" "cyan")"
ZSH_THEME_VIRTUALENV_PREFIX="["
ZSH_THEME_VIRTUALENV_SUFFIX="]"
PROMPT="$(_build_prompt)"
RPROMPT="$(_build_rprompt)"
# vim: ft=sh