summaryrefslogtreecommitdiff
path: root/plugins/dirpersist
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dirpersist')
-rw-r--r--plugins/dirpersist/README.md3
-rw-r--r--plugins/dirpersist/dirpersist.plugin.zsh3
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/dirpersist/README.md b/plugins/dirpersist/README.md
index 9880bc563..792fb4bfe 100644
--- a/plugins/dirpersist/README.md
+++ b/plugins/dirpersist/README.md
@@ -1,6 +1,7 @@
# Dirpersist plugin
-This plugin keeps a running tally of the previous 20 unique directories in the $HOME/.zdirs file. When you cd to a new directory, it is prepended to the beginning of the file.
+This plugin keeps a running tally of the previous 20 unique directories in the `$HOME/.zdirs` file.
+When you cd to a new directory, it is prepended to the beginning of the file.
To use it, add `dirpersist` to the plugins array in your zshrc file:
diff --git a/plugins/dirpersist/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh
index 616e2c3c6..daadc3850 100644
--- a/plugins/dirpersist/dirpersist.plugin.zsh
+++ b/plugins/dirpersist/dirpersist.plugin.zsh
@@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
fi
-chpwd_functions+=(chpwd_dirpersist)
+autoload -U add-zsh-hook
+add-zsh-hook chpwd chpwd_dirpersist
chpwd_dirpersist() {
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
local -ax my_stack