summaryrefslogtreecommitdiff
path: root/plugins/dotenv/dotenv.plugin.zsh
blob: a0c2d0051944c7aba5f22e6919055b0b2924ad32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
source_env() {
  if [[ -f .env ]]; then
    if [[ -o a ]]; then
      source .env
    else
      set -a
      source .env
      set +a
    fi
  fi
}

autoload -U add-zsh-hook
add-zsh-hook chpwd source_env

source_env