-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bar.zsh-theme
56 lines (44 loc) · 1.48 KB
/
bar.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
#
# Origin: https://github.com/anki-code/zsh-bar-theme
#
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[250]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
ZSH_THEME_GIT_PROMPT_CLEAN=""
_PATH="%{$fg_bold[white]%}%~%{$reset_color%}"
if [[ $EUID -eq 0 ]]; then
_LIBERTY="%{$FG[255]%}#"
else
_LIBERTY="%{$FG[250]%}$"
fi
get_space () {
local STR=$1$2
local zero='%([BSUbfksu]|([FB]|){*})'
local LENGTH=${#${(S%%)STR//$~zero/}}
local SPACES="%{$BG[234]%}"
(( LENGTH = ${COLUMNS} - $LENGTH - 1))
for i in {0..$LENGTH}
do
SPACES="$SPACES "
done
echo $SPACES
}
export ZSH_FIRST=1
bar () {
# git
git=$(git_prompt_info)
_git_=`[[ "$git" == '' ]] && V="" || V=" %{$FG[254]%}%{$BG[236]%}$git%{$BG[236]%} %{$reset_color%}"; echo $V`
# conda
_condaenv_=`[[ $CONDA_DEFAULT_ENV == 'base' || $CONDA_DEFAULT_ENV == '' ]] && V="" || V=" %{$FG[254]%}%{$BG[236]%} $CONDA_DEFAULT_ENV %{$reset_color%}"; echo $V`
# Run `spectrum_ls` to search colors
[[ $ZSH_THEME_BAR_HOSTCOLOR == '' ]] && bhc=244 || bhc=$ZSH_THEME_BAR_HOSTCOLOR
# bar
_1LEFT="%{$BG[234]%}%{$FG[$bhc]%}%n %m%{$reset_color%}%{$BG[234]%} %{$FG[253]%}%~%{$reset_color%}"
_1RIGHT="%{$BG[234]%}%{$FG[250]%}$_git_%{$BG[234]%}%{$FG[250]%}$_condaenv_%{$BG[234]%}%{$FG[250]%} %{$FG[244]%}`date --rfc-3339=sec`%{$reset_color%}"
_1SPACES=`get_space $_1LEFT $_1RIGHT`
print
print -rP "$_1LEFT$_1SPACES$_1RIGHT"
}
zle_highlight=( default:fg=green,bold )
PROMPT='$(bar)
$_LIBERTY '