From 158b95594a3153b346413996493d10ac791030a0 Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Fri, 6 Mar 2020 21:39:16 +0500 Subject: Updates. --- files/.zsh/rc/S01_auto_rehash | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 files/.zsh/rc/S01_auto_rehash (limited to 'files/.zsh/rc/S01_auto_rehash') diff --git a/files/.zsh/rc/S01_auto_rehash b/files/.zsh/rc/S01_auto_rehash new file mode 100644 index 0000000..7936ce8 --- /dev/null +++ b/files/.zsh/rc/S01_auto_rehash @@ -0,0 +1,23 @@ +# https://github.com/cofi/dotfiles/blob/master/zsh/auto_rehash + +emulate -L zsh + +rehash_preexec() { + case "$1" in + # debian + *apt*|*apt-get*|*aptitude*) + __rehash=1 + ;; + esac +} + +rehash_precmd() { + if [[ -n __rehash ]]; then + rehash + unset __rehash + fi +} +typeset -ga preexec_functions +typeset -ga precmd_functions +preexec_functions+=rehash_preexec +precmd_functions+=rehash_precmd -- cgit v1.2.3