mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-05-11 05:55:17 +00: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
@@ -96,7 +96,6 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||
|
||||
# Append workon_cwd to the chpwd_functions array, so it will be called on cd
|
||||
# http://zsh.sourceforge.net/Doc/Release/Functions.html
|
||||
if ! (( $chpwd_functions[(I)workon_cwd] )); then
|
||||
chpwd_functions+=(workon_cwd)
|
||||
fi
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd workon_cwd
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user