direnv.plugin.zsh 459 B

1234567891011121314151617
  1. # Don't continue if direnv is not found
  2. command -v direnv &>/dev/null || return
  3. _direnv_hook() {
  4. trap -- '' SIGINT;
  5. eval "$(direnv export zsh)";
  6. trap - SIGINT;
  7. }
  8. typeset -ag precmd_functions;
  9. if [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then
  10. precmd_functions=( _direnv_hook ${precmd_functions[@]} )
  11. fi
  12. typeset -ag chpwd_functions;
  13. if [[ -z ${chpwd_functions[(r)_direnv_hook]} ]]; then
  14. chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
  15. fi