-
Notifications
You must be signed in to change notification settings - Fork 0
/
prompt.sh
33 lines (27 loc) · 880 Bytes
/
prompt.sh
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
# disables prompt mangling in virtual_env/bin/activate
export VIRTUAL_ENV_DISABLE_PROMPT=1
_venv () {
[[ -n ${VIRTUAL_ENV} ]] || return
echo "| %F{red}${VIRTUAL_ENV:t} %F{blue}"
}
_zsh_git () {
local ref
local st
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
[[ -n $(git status --porcelain 2> /dev/null) ]] && st="*" || st=""
echo "%F{cyan} ${ref#refs/heads/}${st} %F{blue}|"
}
_name () {
echo "%F{cyan}%n%F{yellow}@%F{cyan}%m%F{blue}"
}
_path () {
echo "%F{yellow}%d%F{blue}"
}
_date () {
echo "%F{green}%D{"%I:%M"}%F{blue}"
}
PROMPT=\
$'%F{blue}┌──[ $(_name) ]──[ $(_path) ]\n'\
$'%F{blue}└──[$(_zsh_git) $(_date) $(_venv)]───╼ %f'
[[ "$TERM_PROGRAM" != "vscode" ]] && PROMPT=$(echo $PROMPT | sed 's/[└─╼]/%{%G&%}/g')