zsh_reload.plugin.zsh 503 Bytes
Newer Older
1
2
3
src() {
	local cache="$ZSH_CACHE_DIR"
	autoload -U compinit zrecompile
4
	compinit -i -d "$cache/zcomp-$HOST"
5

6
	for f in ${ZDOTDIR:-~}/.zshrc "$cache/zcomp-$HOST"; do
7
8
		zrecompile -p $f && command rm -f $f.zwc.old
	done
9

10
11
12
13
14
15
16
17
18
19
20
21
	# Use $SHELL if it's available and a zsh shell
	local shell="$ZSH_ARGZERO"
	if [[ "${${SHELL:t}#-}" = zsh ]]; then
		shell="$SHELL"
	fi

	# Remove leading dash if login shell and run accordingly
	if [[ "${shell:0:1}" = "-" ]]; then
		exec -l "${shell#-}"
	else
		exec "$shell"
	fi
22
}