-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathzprompt
42 lines (34 loc) · 1.15 KB
/
zprompt
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
function prompt_molo_precmd {
git-info
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
}
function venv_prompt_info {
if [ -n "${VIRTUAL_ENV+set}" ]; then
echo "($(basename "$VIRTUAL_ENV"))"
fi
}
function prompt_molo_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
# Load required functions.
autoload -Uz add-zsh-hook
# Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_molo_precmd
# Set git-info parameters.
zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:branch' format '%F{green}%b%f'
zstyle ':prezto:module:git:info:clean' format ' %F{green}o%f'
zstyle ':prezto:module:git:info:dirty' format ' %F{red}x%f'
zstyle ':prezto:module:git:info:keys' format \
'prompt' ' %F{green}(%f$(coalesce "%b" "%p" "%c")${git_info[rprompt]}%s%F{green})%f' \
'rprompt' '%C%D'
# Define prompts.
PROMPT='
%F{red}%n %F{white}at %F{yellow}$(box_name) %F{white}in %F{cyan}%~%F{white}${(e)git_info[prompt]} %F{yellow}$(venv_prompt_info)%F{white}
%F{blue}>> %F{white}'
RPROMPT=''
}
prompt_molo_setup "$@"