From f31115efd8d7d5b3b1c23c50971cbf3801b54c7a Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 9 Jan 2022 15:51:54 -0500 Subject: [PATCH] ENH make functions for activating environments --- dot_config/zsh/dot_zshrc.tmpl | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/dot_config/zsh/dot_zshrc.tmpl b/dot_config/zsh/dot_zshrc.tmpl index a46241b..f10c7e3 100644 --- a/dot_config/zsh/dot_zshrc.tmpl +++ b/dot_config/zsh/dot_zshrc.tmpl @@ -58,12 +58,31 @@ x11-clip-wrap-widgets paste $paste_widgets # involve a) adding a "shims" directory to PATH and then b) adding some shell # magic to automatically call the shims -if command -v pyenv 1>/dev/null 2>&1; then - eval "$(pyenv init - | sed '/PATH/d' -)" - eval "$(pyenv virtualenv-init - | sed '/PATH/d' -)" -fi +zsh-pyenv () { + if command -v pyenv 1>/dev/null 2>&1; then + echo "Activating pyenv" + eval "$(pyenv init - | sed '/PATH/d' -)" + eval "$(pyenv virtualenv-init - | sed '/PATH/d' -)" + else + echo "pyenv not installed" + fi +} -if command -v rbenv 1>/dev/null 2>&1; then - eval "$(rbenv init - | sed '/PATH/d' -)" -fi + +zsh-rbenv () { + if command -v rbenv 1>/dev/null 2>&1; then + echo "Activating rbenv" + eval "$(rbenv init - | sed '/PATH/d' -)" + else + echo "rbenv not installed" + fi +} + +zsh-conda () { + if [[ -x $XDG_DATA_HOME/mambaforge/bin/conda ]]; then + eval "$($XDG_DATA_HOME/mambaforge/bin/conda shell.zsh hook)" + else + echo "conda installation not found" + fi +} {{- end }}