dotfiles/home/.config/zsh/08-pacman.zsh

18 lines
427 B
Bash
Raw Normal View History

# from https://wiki.archlinux.org/index.php/Zsh#On-demand_rehash
2021-08-17 20:54:45 +03:00
zshcache_time="$(date +%s%N)"
autoload -Uz add-zsh-hook
rehash_precmd() {
2022-03-11 18:14:21 +02:00
if [[ -e /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
2021-08-17 20:54:45 +03:00
fi
}
2021-08-17 20:54:45 +03:00
add-zsh-hook -Uz precmd rehash_precmd