-
Notifications
You must be signed in to change notification settings - Fork 0
/
min.zsh
42 lines (35 loc) · 786 Bytes
/
min.zsh
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
# Git status symbols
ZSH_THEME_GIT_PROMPT_PREFIX="%F{242}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%f "
ZSH_THEME_GIT_PROMPT_DIRTY="±"
# Prompt symbol
min_status() {
echo -n "%(?.%F{green}.%F{red})→%f "
}
# Username
min_user() {
if [[ $USER == 'root' ]]; then
echo -n "%F{red}"
else
echo -n "%F{yellow}"
fi
echo -n "%n"
}
# Username and ssh host
min_host() {
if [[ -n $SSH_CONNECTION ]]; then
echo -n "$(min_user)@%m%f "
elif [[ $LOGNAME != $USER ]] || [[ $USER == 'root' ]]; then
echo -n "$(min_user)%f "
fi
}
# Current directory
min_current_dir() {
echo -n "%B%F{grey}%.%f%b "
}
# Git status
min_git_status() {
echo -n "$(git_prompt_status)$(git_prompt_info)"
}
# Compose prompt
PROMPT='$(min_status)$(min_host)$(min_current_dir)$(min_git_status)'