From c416a5304be4a6cd723fd4c5036e9c5f1de172af Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 15 Apr 2023 18:01:04 -0500 Subject: [PATCH] refactor: Move conda hooks to .hooks --- dot_hooks.tmpl | 15 +++++++++++++++ executable_dot_bashrc.tmpl | 16 ---------------- executable_dot_zshrc.tmpl | 15 --------------- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/dot_hooks.tmpl b/dot_hooks.tmpl index 69a2185..ead7ebd 100644 --- a/dot_hooks.tmpl +++ b/dot_hooks.tmpl @@ -1,3 +1,18 @@ +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$($HOME/miniconda3/bin/conda shell.$(basename $0) 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then + . "$HOME/miniconda3/etc/profile.d/conda.sh" + else + export PATH="$HOME/miniconda3/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< + if [ -f $HOME/.ion/bin/ion ]; then export PATH="$HOME/.ion/bin/ion:$PATH" export FPATH="$HOME/.ion/completions:$FPATH" diff --git a/executable_dot_bashrc.tmpl b/executable_dot_bashrc.tmpl index 7782a56..732a3b7 100644 --- a/executable_dot_bashrc.tmpl +++ b/executable_dot_bashrc.tmpl @@ -11,22 +11,6 @@ source $HOME/.hooks # User specific aliases and functions source $HOME/.aliases -# >>> conda initialize >>> -# !! Contents within this block are managed by 'conda init' !! -__conda_setup="$('$HOME/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then - . "$HOME/miniconda3/etc/profile.d/conda.sh" - else - export PATH="$HOME/miniconda3/bin:$PATH" - fi -fi -unset __conda_setup -conda config --set changeps1 true -# <<< conda initialize <<< - # >>> direnv initalize >>> if [ $(command -v direnv) ]; then eval "$(direnv hook bash)" diff --git a/executable_dot_zshrc.tmpl b/executable_dot_zshrc.tmpl index 5c42c92..bedc10e 100644 --- a/executable_dot_zshrc.tmpl +++ b/executable_dot_zshrc.tmpl @@ -54,21 +54,6 @@ COMPLETION_WAITING_DOTS="true" source $HOME/.hooks -# >>> conda initialize >>> -# !! Contents within this block are managed by 'conda init' !! -__conda_setup="$('$HOME/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then - . "$HOME/miniconda3/etc/profile.d/conda.sh" - else - export PATH="$HOME/miniconda3/bin:$PATH" - fi -fi -unset __conda_setup -# <<< conda initialize <<< - # >>> direnv initalize >>> if [ $(command -v direnv) ]; then eval "$(direnv hook zsh)"