diff --git a/modules/autoenv/README.md b/modules/autoenv/README.md new file mode 100644 index 00000000..f5895405 --- /dev/null +++ b/modules/autoenv/README.md @@ -0,0 +1,16 @@ +Autoenv +======= + +Provides integration for the [autoenv][1] shell environment settings +tool. + +Settings +-------- + +By default this plugin finds autoenv as it's installed by Mac homebrew, +in `/usr/local/opt/autoenv/activate.sh`. To find the autoenv script in +another location, add the following line to *zpreztorc*: + + zstyle ':prezto:module:autoenv' script PATH_TO_AUTOENV_ACTIVATE + +[1]: https://github.com/kennethreitz/autoenv diff --git a/modules/autoenv/init.zsh b/modules/autoenv/init.zsh new file mode 100644 index 00000000..523ca6ac --- /dev/null +++ b/modules/autoenv/init.zsh @@ -0,0 +1,14 @@ +# silently falls back to '' if homebrew is not installed +_autoenv_base=$(brew --prefix 2>/dev/null) + +zstyle -s ':prezto:module:autoenv' script "_autoenv_script" || _autoenv_script=${_autoenv_base}/opt/autoenv/activate.sh + +if [[ -s $_autoenv_script ]]; then + source $_autoenv_script + unset _autoenv_script + unset _autoenv_base +else + unset _autoenv_script + unset _autoenv_base + return 1 +fi