mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-07 07:50:40 +01:00
Use safer append to hook function arrays (#8406)
Use add-zsh-hook to add functions to hooks. That way they won't be added again when doing `source ~/.zshrc` multiple times. Co-authored-by: Marc Cornellà <marc.cornella@live.com>
This commit is contained in:
committed by
Marc Cornellà
parent
d4f32e9f3a
commit
1ba0af650a
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user