blob: c53d7629459b993da4db04374967edfd8291af09 (
plain)
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
|
prompt_kyrias_help() {
cat <<EOF
kyrias' prompt.
EOF
}
prompt_user_color() {
if (( ! UID )); then
print "red"
else
print "black"
fi
}
venv_prompt() {
if [[ -n "$VIRTUAL_ENV" ]]; then
print -P '%{$bg[blue]$fg[white] ${VIRTUAL_ENV##*/} %f%k%}'
fi
}
prompt_kyrias_precmd() {
# Print line to the window title
print -Pn "\e];%n %~\a"
}
prompt_kyrias_preexec() {
# Print currently running command name to the window title
print -Pn "\e];$1:q\a"
}
prompt_kyrias_setup() {
setopt prompt_subst
autoload -U colors && colors
add-zsh-hook precmd prompt_kyrias_precmd
add-zsh-hook preexec prompt_kyrias_preexec
PROMPT='%{$bg[$(prompt_user_color)]$fg[white] %m %k%f$bg[white]$fg[$(prompt_user_color)] %~ %f%k$(venv_prompt)
$bg[blue]%} λ %k %}'
}
prompt_kyrias_preview() {
prompt_preview_theme kyrias "$@"
}
prompt_kyrias_setup "$@"
# vim: ft=zsh
|