diff options
| author | Pedro Pereira <pedro.hr.pereira@proton.me> | 2026-10-16 15:19:13 -0300 |
|---|---|---|
| committer | Pedro Pereira <pedro.hr.pereira@proton.me> | 2026-10-16 15:19:13 -0300 |
| commit | 1eb69e9a795cc19450178c07d8d382622bc7ad70 (patch) | |
| tree | b6bc60605044fe929986f31b3b6bf4fee9b56e14 /.config/zsh/oh-my-zsh/plugins/direnv/direnv.plugin.zsh | |
first commit
Diffstat (limited to '.config/zsh/oh-my-zsh/plugins/direnv/direnv.plugin.zsh')
| -rw-r--r-- | .config/zsh/oh-my-zsh/plugins/direnv/direnv.plugin.zsh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/.config/zsh/oh-my-zsh/plugins/direnv/direnv.plugin.zsh b/.config/zsh/oh-my-zsh/plugins/direnv/direnv.plugin.zsh new file mode 100644 index 0000000..c026dbe --- /dev/null +++ b/.config/zsh/oh-my-zsh/plugins/direnv/direnv.plugin.zsh @@ -0,0 +1,19 @@ +# If direnv is not found, don't continue and print a warning +if (( ! $+commands[direnv] )); then + echo "Warning: direnv not found. Please install direnv and ensure it's in your PATH before using this plugin." + return +fi + +_direnv_hook() { + trap -- '' SIGINT; + eval "$(direnv export zsh)"; + trap - SIGINT; +} +typeset -ag precmd_functions; +if [[ -z "${precmd_functions[(r)_direnv_hook]+1}" ]]; then + precmd_functions=( _direnv_hook ${precmd_functions[@]} ) +fi +typeset -ag chpwd_functions; +if [[ -z "${chpwd_functions[(r)_direnv_hook]+1}" ]]; then + chpwd_functions=( _direnv_hook ${chpwd_functions[@]} ) +fi |
