Update Direnv hook to match current recommendation
This commit is contained in:
parent
60f637b609
commit
1bc2b49e3f
1 changed files with 8 additions and 4 deletions
|
@ -1,8 +1,12 @@
|
|||
#! zsh
|
||||
_direnv_hook() {
|
||||
eval "$(direnv export zsh)"
|
||||
trap -- '' SIGINT
|
||||
emulate zsh -c "$(direnv export zsh)"
|
||||
trap - SIGINT
|
||||
}
|
||||
typeset -ag precmd_functions
|
||||
if (( $+commands[direnv] )) && [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then
|
||||
precmd_functions+=(_direnv_hook)
|
||||
|
||||
typeset -ag precmd_functions chpwd_functions
|
||||
if (( $+commands[direnv] )); then
|
||||
[[ -z ${precmd_functions[(r)_direnv_hook]} ]] && precmd_functions+=(_direnv_hook)
|
||||
[[ -z ${chpwd_functions[(r)_direnv_hook]} ]] && chpwd_functions+=(_direnv_hook)
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue