dotfiles/shell/zsh/rehash.zsh

11 lines
294 B
Bash

autoload -U add-zsh-hook
# rehash on SIGUSR1
TRAPUSR1() { rehash };
# anything newly intalled from last command?
precmd_install() { [[ $history[$[ HISTCMD -1 ]] == *(apt|apt-get|yay|pacman|pamac|pip)* ]] && killall -u $USER -USR1 zsh }
# do this on precmd
add-zsh-hook precmd precmd_install