configs  Check-in [aad9f4af74]

Overview
Comment:zshrc: Fix compatibility with zsh 4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aad9f4af742063cc2771f90d22ca86b13f59cbe84e77c96a15f9e69db1768439
User & Date: js 2024-02-07 22:20:15
Context
2024-02-07
22:30
vimrc: Fix compatibility with vim < 7.3 check-in: e763ba8f40 user: js tags: trunk
22:20
zshrc: Fix compatibility with zsh 4 check-in: aad9f4af74 user: js tags: trunk
2024-01-04
20:38
zshrc: Remove ix.io - it's dead check-in: 1dd5422a22 user: js tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to zshrc.

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
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export EDITOR="vim"
export VIMINIT="source $XDG_CONFIG_HOME/vim/vimrc"
export PAGER="less"
export LS_COLORS='di=34:ow=44;37:tw=44;37:st=44;37:ex=31:su=7;31:sg=7;31:ln=33:or=7;33:pi=32:do=32:bd=35:cd=35:so=32:*.bz2=36:*.dmg=36:*.gz=36:*.gpg=36:*.rar=36:*.tar=36:*.tbz2=36:*.tgz=36:*.xz=36:*.zip=36:*.orig=90:*~=90'
export SUDO_PROMPT=$(printf "\033[0;31m[\033[1;31msudo -> %%U\033[0;31m]\033[0m Password for \033[1m%%p@%%H\033[0m: ")
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export CVS_RSH="ssh"
LISTMAX=32768
WORDCHARS="*?[];!#~"
local grep=""
local grep_color="auto"
local ls=""
local ls_color="auto"
local ls_on_cd="yes"
local ls_on_init="no"
local normal_user="js"



if [ "$COLORTERM" = "24bit" -o "$COLORTERM" = "truecolor" \
    -o "$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"


elif [ "$terminfo[colors]" = 256 ]; then
	local color_cwd="29"
	local color_host="23"
	local color_suffix="36"
	local color_vcs="78"
	local color_vcs_braces="36"


else
	local color_cwd=2
	local color_host=6
	local color_suffix=2
	local color_vcs=2
	local color_vcs_braces=2
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.







|












>
>
|






>
>
|





>
>






<
|
|
>







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
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export EDITOR="vim"
export VIMINIT="source $XDG_CONFIG_HOME/vim/vimrc"
export PAGER="less"
export LS_COLORS='di=34:ow=44;37:tw=44;37:st=44;37:ex=31:su=7;31:sg=7;31:ln=33:or=7;33:pi=32:do=32:bd=35:cd=35:so=32:*.bz2=36:*.dmg=36:*.gz=36:*.gpg=36:*.rar=36:*.tar=36:*.tbz2=36:*.tgz=36:*.xz=36:*.zip=36:*.orig=90:*~=90'
export SUDO_PROMPT="$(printf "\033[0;31m[\033[1;31msudo -> %%U\033[0;31m]\033[0m Password for \033[1m%%p@%%H\033[0m: ")"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export CVS_RSH="ssh"
LISTMAX=32768
WORDCHARS="*?[];!#~"
local grep=""
local grep_color="auto"
local ls=""
local ls_color="auto"
local ls_on_cd="yes"
local ls_on_init="no"
local normal_user="js"

autoload -U is-at-least

if is-at-least 5.0.0 && [ "$COLORTERM" = "24bit" -o "$COLORTERM" = "truecolor" \
    -o "$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"
	local color_jobs="yellow"
	local color_status="red"
elif is-at-least 5.0.0 && [ "$terminfo[colors]" = 256 ]; then
	local color_cwd="29"
	local color_host="23"
	local color_suffix="36"
	local color_vcs="78"
	local color_vcs_braces="36"
	local color_jobs="yellow"
	local color_status="red"
else
	local color_cwd=2
	local color_host=6
	local color_suffix=2
	local color_vcs=2
	local color_vcs_braces=2

	local color_jobs=3
	local color_status=1
fi

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.
112
113
114
115
116
117
118








119
120
121
122
123
124
125
126
127
128
129
130
131
132

133

134
135
136
137
138
139
140
	;;
*)
	__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

	if [ "$(whoami)" != "$normal_user" ]; then
		local user="%n@"
	fi

	PS1="%F{$color_host}$user%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)







>
>
>
>
>
>
>
>

|
|






|
|

|
|
>
|
>







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
	;;
*)
	__update_terminal_cwd() {}
	;;
esac

set_prompt() {
	if is-at-least 5.0.0; then
		color() { printf "%%F{$1}" }
		nocolor() { printf "%%f" }
	else
		color() { printf "%%{\033[3${1}m%%}" }
		nocolor() { printf "%%{\033[0m%%}" }
	fi

	if [ -n "$1" ]; then
	       	local branch="$(color $color_vcs_braces)($(color $color_vcs)$1"
		branch+="$(color $color_vcs_braces))"
	fi

	if [ "$(whoami)" != "$normal_user" ]; then
		local user="%n@"
	fi

	PS1="$(color $color_host)$user%m $(color $color_cwd)%c$branch"
	PS1+="$(color $color_suffix)%(!.#.>)$(nocolor) "
	PS2="%B>%b "
	RPS1="%(1j.$(color $color_jobs)%B%j%b$(nocolor).)%(?..%(1j. .)"
	RPS1+="$(color $color_status)%B%?%b$(nocolor))"
	RPS2="%(1_.$(color black)%B(%_%)%b$(nocolor).)"

	unfunction color nocolor
}
set_prompt

__precmd() {
	__update_terminal_cwd

	local branch=$(fossil branch current 2>/dev/null)
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
		# Without this, precmd would override it
		precmd() { __precmd }
		print -Pn "\e]0;$@\a"
	}

	unset_title() {
		precmd() {
			print -Pn "\e]0;%c ยท %m\a"
			__precmd
		}
	}
	unset_title
	;;
*)
	precmd() { __precmd }







|







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
		# Without this, precmd would override it
		precmd() { __precmd }
		print -Pn "\e]0;$@\a"
	}

	unset_title() {
		precmd() {
			print -Pn "\e]0;%m:%c\a"
			__precmd
		}
	}
	unset_title
	;;
*)
	precmd() { __precmd }
218
219
220
221
222
223
224


225
226
227
228
229
230
231
232
	alias -s "$ext=extr"
done

__has_command vim && alias vi=vim
__has_command gpg2 && alias gpg=gpg2

if [ "$(uname -s)" = "Darwin" ]; then


	export MAKEFLAGS="-j$(($(sysctl -n machdep.cpu.thread_count) * 2))"
elif [ "$(uname -s)" = "NetBSD" ]; then
	export MAKEFLAGS="-j$(($(/sbin/sysctl -n hw.ncpu) * 2))"
elif __has_command nproc; then
	export MAKEFLAGS="-j$(($(nproc) * 2))"
fi

make() {







>
>
|







234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	alias -s "$ext=extr"
done

__has_command vim && alias vi=vim
__has_command gpg2 && alias gpg=gpg2

if [ "$(uname -s)" = "Darwin" ]; then
	local thread_count="$(sysctl -n machdep.cpu.thread_count 2>/dev/null)"
	test -z "$thread_count" && thread_count=1
	export MAKEFLAGS="-j$((thread_count * 2))"
elif [ "$(uname -s)" = "NetBSD" ]; then
	export MAKEFLAGS="-j$(($(/sbin/sysctl -n hw.ncpu) * 2))"
elif __has_command nproc; then
	export MAKEFLAGS="-j$(($(nproc) * 2))"
fi

make() {