aboutsummaryrefslogtreecommitdiff
path: root/files/.zsh/rc/S01_auto_rehash
diff options
context:
space:
mode:
authorAnton Bobov <abobov@gmail.com>2020-03-06 21:39:16 +0500
committerAnton Bobov <abobov@gmail.com>2020-03-06 21:39:16 +0500
commit158b95594a3153b346413996493d10ac791030a0 (patch)
tree6e68896235e24f56e7826d69be3f713cf1eaf3d7 /files/.zsh/rc/S01_auto_rehash
parenteb1e2e2f52a046d877e3e2f6e980e6a9912eade3 (diff)
Updates.
Diffstat (limited to 'files/.zsh/rc/S01_auto_rehash')
-rw-r--r--files/.zsh/rc/S01_auto_rehash23
1 files changed, 23 insertions, 0 deletions
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