configs  Check-in [062db63578]

Overview
Comment:zshrc: Add support for 24-bit color
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 062db635780ca6074f41f1d1bf0ee7906af83b17390d87f03f8f2560b06d5d0a
User & Date: js on 2020-06-14 20:54:36
Other Links: manifest | tags
Context
2020-06-14
21:00
zshrc: More ways to check for truecolor terminal check-in: 9686d84236 user: js tags: trunk
20:54
zshrc: Add support for 24-bit color check-in: 062db63578 user: js tags: trunk
2020-06-07
10:46
fish_prompt.fish: Fix space error check-in: 0b3f585e66 user: js tags: trunk
Changes

Modified zshrc from [dffe1ca736] to [c3ff016202].

10
11
12
13
14
15
16
17















18
19
20
21
22
23
24
WORDCHARS="*?[];!#~"
local grep=""
local grep_color="auto"
local ls=""
local ls_color="auto"
local ls_on_cd="yes"
local ls_on_init="no"
local simple_prompt="no"
















bindkey -v
# history-incremental-search-backward is much more useful than
# _history-complete-*
bindkey "^R" history-incremental-search-backward
# Add a few other emacs bindings for convenience, as it's sometimes quicker to
# use those than to switch between modes.







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
WORDCHARS="*?[];!#~"
local grep=""
local grep_color="auto"
local ls=""
local ls_color="auto"
local ls_on_cd="yes"
local ls_on_init="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
# _history-complete-*
bindkey "^R" history-incremental-search-backward
# Add a few other emacs bindings for convenience, as it's sometimes quicker to
# use those than to switch between modes.
73
74
75
76
77
78
79
80
81

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
105
106
107
		}
		;;
	*)
		__update_terminal_cwd() {}
		;;
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"

		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
set_prompt

__precmd() {
	__update_terminal_cwd

	local branch=$(fossil branch current 2>/dev/null)








<
|
>
|
|
|
<
<
<
<
|
<
<
<
<
|
|
|
|
>
|
|
<







88
89
90
91
92
93
94

95
96
97
98
99




100




101
102
103
104
105
106
107

108
109
110
111
112
113
114
		}
		;;
	*)
		__update_terminal_cwd() {}
		;;
esac


set_prompt() {
	if [ -n "$1" ]; then
	       	local branch="%F{$color_vcs_braces}(%F{$color_vcs}$1"
		branch+="%F{$color_vcs_braces})"
	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() {
	__update_terminal_cwd

	local branch=$(fossil branch current 2>/dev/null)