~muirrum/dotfiles

15f78a463d39c1b9a560155bcf91478e308ce84a — Cara Salter 6 months ago 5c001c5
add auto-activate venv code
1 files changed, 21 insertions(+), 1 deletions(-)

M .zshrc
M .zshrc => .zshrc +21 -1
@@ 23,7 23,7 @@ export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export PATH=/home/$USER/.cargo/bin:/home/$USER/bin:/home/$USER/bin/uni:$PATH:/home/$USER/go/bin:/home/$USER/.local/bin:$GEM_HOME/bin
export PATH=/home/$USER/.local/bin:/home/$USER/.cargo/bin:/home/$USER/bin:/home/$USER/bin/uni:$PATH:/home/$USER/go/bin:/home/$USER/.local/bin:$GEM_HOME/bin
export EDITOR=nvim

export XDG_CURRENT_DESKTOP=sway


@@ 69,3 69,23 @@ if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
	add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
	add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi


function cd() {
  builtin cd "$@"

  if [[ -z "$VIRTUAL_ENV" ]] ; then
    ## If env folder is found then activate the vitualenv
      if [[ -d ./.venv ]] ; then
        source ./.venv/bin/activate
      fi
  else
    ## check the current folder belong to earlier VIRTUAL_ENV folder
    # if yes then do nothing
    # else deactivate
      parentdir="$(dirname "$VIRTUAL_ENV")"
      if [[ "$PWD"/ != "$parentdir"/* ]] ; then
        deactivate
      fi
  fi
}