fix: bug in venv
This commit is contained in:
parent
617aec60ce
commit
6f93a68bf4
1 changed files with 3 additions and 3 deletions
|
@ -3,14 +3,14 @@ add-zsh-hook chpwd __python_change_venv
|
|||
|
||||
function __python_change_venv() {
|
||||
local _path=$(pwd)
|
||||
local _paths="${_path}"
|
||||
local _paths=("${_path}")
|
||||
|
||||
while [[ "${_path}" != "${HOME}" ]] && [[ "${_path}" != "/" ]]; do
|
||||
_path="${_path:h}"
|
||||
_paths="${_paths} ${_path}"
|
||||
_paths+=("${_path}")
|
||||
done
|
||||
|
||||
for _p in ${(z)_paths}; do
|
||||
for _path in ${_paths}; do
|
||||
local _venv_config=$(find "${_path}" -maxdepth 2 -mindepth 2 -name pyvenv.cfg 2>/dev/null | head -n1)
|
||||
if [[ ${_venv_config} != "" ]]; then
|
||||
local _venv_path="${_venv_config:h}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue