summaryrefslogtreecommitdiff
path: root/plugins-customization.zsh
blob: 563b169a61d6e3a773df49c9560e7c0c93a9a179 (plain)
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
##
## Plugins — zimfw
##

ZIM_CONFIG_FILE="$HOME/.config/zsh/zimrc"
ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim

# fpath+=~/.zfunc

# Install missing modules and update init.zsh if missing or outdated.
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZIM_CONFIG_FILE} ]]; then
	source /usr/share/zimfw/zimfw.zsh init
fi

source ${ZIM_HOME}/init.zsh

zshcache_time="$(date +%s%N)"

autoload -Uz add-zsh-hook
# autoload -Uz compinit && compinit

rehash_precmd() {
	if [[ -a /var/cache/zsh/pacman ]]; then
		local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)"
		if (( zshcache_time < paccache_time )); then
			rehash
			zshcache_time="$paccache_time"
		fi
	fi
}

add-zsh-hook -Uz precmd rehash_precmd

eval "$(atuin init zsh --disable-up-arrow)"
eval "$(zoxide init zsh --cmd cd)"