mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-08-09 23:07:56 +02: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
@ -25,5 +25,6 @@ __timer_display_timer_precmd() {
|
||||
fi
|
||||
}
|
||||
|
||||
preexec_functions+=(__timer_save_time_preexec)
|
||||
precmd_functions+=(__timer_display_timer_precmd)
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook preexec __timer_save_time_preexec
|
||||
add-zsh-hook precmd __timer_display_timer_precmd
|
||||
|
Reference in New Issue
Block a user