b5d4dbc893201e259499829ed801cd3219cc07bc
- Author
- Nick Cross <ncross@redhat.com>
- Committer
- Nick Cross <ncross@redhat.com>
- Date
Message
Add manual install instructions. Unset venv_* when deactivating. Stop check at $HOME
Diff
1diff --git a/README.rst b/README.rst
2index 161308c643b9678422cc991c31b28db75181ab85..20583553595a2d39dedb7d8aa461c0b28e0c1140 100644
3--- a/README.rst
4+++ b/README.rst
5@@ -84,13 +84,18 @@ is the directory with custom plugins of oh-my-zsh `(read more) <https://github.c
6
7 git clone "https://github.com/MichaelAquilina/zsh-autoswitch-virtualenv.git" "$ZSH_CUSTOM/plugins/autoswitch_virtualenv"
8
9-
10 Then add this line to your ``.zshrc``
11
12 ::
13
14 plugins=(autoswitch_virtualenv $plugins)
15
16+Manual Installation
17+
18+::
19+
20+ source .../zsh-autoswitch-virtualenv/autoswitch_virtualenv.plugin.zsh
21+
22
23 Pipenv Integration
24 ------------------
25diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
26index 4aabc5d40c7683d2f5f3b46ff879779e2e6438f6..174bb60a189e628c0e1705d93227a49bf7c4433d 100644
27--- a/autoswitch_virtualenv.plugin.zsh
28+++ b/autoswitch_virtualenv.plugin.zsh
29@@ -81,7 +81,8 @@ function _check_venv_path()
30 printf "${check_dir}/.venv"
31 return
32 else
33- if [ "$check_dir" = "/" ]; then
34+ # Abort search at file system root or HOME directory.
35+ if [[ "$check_dir" = "/" || "$check_dir" = "$HOME" ]]; then
36 return
37 fi
38 _check_venv_path "$(dirname "$check_dir")"
39@@ -142,6 +143,7 @@ function _default_venv()
40 _maybeworkon "$(_virtual_env_dir "$AUTOSWITCH_DEFAULTENV")" "virtualenv"
41 elif [[ -n "$VIRTUAL_ENV" ]]; then
42 deactivate
43+ unset venv_dir venv_name venv_path venv_type
44 fi
45 }
46