mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +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:
parent
d4f32e9f3a
commit
1ba0af650a
12 changed files with 29 additions and 23 deletions
|
|
@ -53,7 +53,8 @@ function push_future() {
|
|||
}
|
||||
|
||||
# Called by zsh when directory changes
|
||||
chpwd_functions+=(chpwd_dirhistory)
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd chpwd_dirhistory
|
||||
function chpwd_dirhistory() {
|
||||
push_past $PWD
|
||||
# If DIRHISTORY_CD is not set...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue