From 45118f095e7176437b4ba8098f2a5df2aeb7246a Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Fri, 24 Jan 2025 10:31:57 -0700 Subject: [PATCH] Bash: source venv on startup --- bash/.bash_functions | 5 ++--- bash/.bash_profile | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bash/.bash_functions b/bash/.bash_functions index ea472bf..d4f8348 100644 --- a/bash/.bash_functions +++ b/bash/.bash_functions @@ -434,10 +434,9 @@ loadvenv() { while [[ "$PWD" != "/" ]]; do for x in $(fd -HI -td --maxdepth=1); do - if [[ "$x" == '.venv/' || "$x" == 'venv/' ]]; then + if [[ -f "$x/bin/activate" ]]; then source "${x}/bin/activate" - cd "$init_dir" - return + break 2 fi done diff --git a/bash/.bash_profile b/bash/.bash_profile index f9feced..cd84c01 100644 --- a/bash/.bash_profile +++ b/bash/.bash_profile @@ -99,4 +99,6 @@ fi # Bash completion ==== source_completion_scripts +loadvenv + # vim: set ft=bash ff=unix: