zshrc: Add support for 24-bit color
This commit is contained in:
parent
c6507006d9
commit
58d4d12498
1 changed files with 28 additions and 21 deletions
49
zshrc
49
zshrc
|
@ -14,7 +14,22 @@ local ls=""
|
|||
local ls_color="auto"
|
||||
local ls_on_cd="yes"
|
||||
local ls_on_init="no"
|
||||
local simple_prompt="no"
|
||||
|
||||
if [ "$terminfo[colors]" = 16777216 ]; then
|
||||
local color_cwd="#209060"
|
||||
local color_host="#176945"
|
||||
local color_suffix="#29bc7d"
|
||||
local color_vcs="#43d696"
|
||||
local color_vcs_braces="#29bc7d"
|
||||
else
|
||||
local color_cwd="29"
|
||||
local color_host="23"
|
||||
local color_suffix="36"
|
||||
local color_vcs="78"
|
||||
local color_vcs_braces="36"
|
||||
fi
|
||||
local color_jobs="yellow"
|
||||
local color_status="red"
|
||||
|
||||
bindkey -v
|
||||
# history-incremental-search-backward is much more useful than
|
||||
|
@ -77,27 +92,19 @@ case $TERM_PROGRAM in
|
|||
;;
|
||||
esac
|
||||
|
||||
if [ "$simple_prompt" = yes ]; then
|
||||
set_prompt() {
|
||||
local branch
|
||||
[ -n "$1" ] && branch="%F{black}%B(%b%F{cyan}$1%F{black}%B)%b%f"
|
||||
set_prompt() {
|
||||
if [ -n "$1" ]; then
|
||||
local branch="%F{$color_vcs_braces}(%F{$color_vcs}$1"
|
||||
branch+="%F{$color_vcs_braces})"
|
||||
fi
|
||||
|
||||
PS1="%m:%c$branch%B%(!.#.$)%b "
|
||||
PS2="%B>%b "
|
||||
RPS1="%(1j.%F{yellow}%j%f.)%(?..%(1j. .)%F{red}%?%f)"
|
||||
RPS2="%(1_.%F{black}%B(%_%)%b%f.)"
|
||||
}
|
||||
else
|
||||
set_prompt() {
|
||||
local branch
|
||||
[ -n "$1" ] && branch="%F{36}(%F{78}$1%F{36})"
|
||||
|
||||
PS1="%F{23}%m %F{29}%c$branch%F{36}%(!.#.>)%f "
|
||||
PS2="%B>%b "
|
||||
RPS1="%(1j.%F{yellow}%j%f.)%(?..%(1j. .)%F{red}%?%f)"
|
||||
RPS2="%(1_.%F{black}%B(%_%)%b%f.)"
|
||||
}
|
||||
fi
|
||||
PS1="%F{$color_host}%m %F{$color_cwd}%c$branch"
|
||||
PS1+="%F{$color_suffix}%(!.#.>)%f "
|
||||
PS2="%B>%b "
|
||||
RPS1="%(1j.%F{$color_jobs}%B%j%b%f.)%(?..%(1j. .)"
|
||||
RPS1+="%F{$color_status}%B%?%b%f)"
|
||||
RPS2="%(1_.%F{black}%B(%_%)%b%f.)"
|
||||
}
|
||||
set_prompt
|
||||
|
||||
__precmd() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue