diff --git a/bash/direnv-hook b/bash/direnv-hook new file mode 100644 index 0000000..38a118b --- /dev/null +++ b/bash/direnv-hook @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +_direnv_hook() { + eval "$(direnv export bash)"; +}; + +if type direnv > /dev/null; then + if ! [[ "$PROMPT_COMMAND" =~ _direnv_hook ]]; then + PROMPT_COMMAND="_direnv_hook;$PROMPT_COMMAND"; + fi +fi diff --git a/bashrc b/bashrc index 8bbe045..ab44236 100644 --- a/bashrc +++ b/bashrc @@ -43,3 +43,7 @@ fi if [ -f ~/.bash/prompt ]; then source ~/.bash/prompt fi + +if [ -f ~/.bash/direnv-hook ]; then + source ~/.bash/direnv-hook +fi