Automatially Activate venv When Found in Directory

# Function to activate virtualenv if present                                    
auto_activate_virtualenv() {                                                    
  if [ -f "bin/activate" ]; then                                                
    source bin/activate                                                         
  fi                                                                            
}                                                                               
# Add the function to chpwd hooks                                               
add-zsh-hook chpwd auto_activate_virtualenv

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.