]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - README.md
Minor code cleanup/optimization
[zsh-autoenv.git] / README.md
index dac04dcf1d5e2a59d96a961c3dccc7ccf99d8b84..fc86547bfda26fad387928b6203e8626940abf37 100644 (file)
--- a/README.md
+++ b/README.md
@@ -126,8 +126,22 @@ Default: 0
 ### AUTOENV\_DEBUG
 Enable debugging. Multiple levels are supported (max 2).
 
+- 0: no debug messages
+- 1: generic debug logging
+- 2: more verbose messages
+  - messages about adding/removing files on the internal stack
+- 3: everything
+  - sets xtrace option (`set -x`) while sourcing env files
+
 Default: `0`
 
+## Usage
+
+zsh-autoenv works automatically once installed.
+
+You can use ``autoenv-edit`` to edit the nearest/current autoenv files.
+It will use ``$AUTOENV_EDITOR``, ``$EDITOR``, or ``vim`` for editing.
+
 ## Recipes
 
 ### Automatically activate Python virtualenvs
@@ -154,17 +168,17 @@ if [[ $autoenv_event == 'enter' ]]; then
     local -a venv
     venv=(./(../)#.venv(NY1:A))
 
-    if [[ -n "$_ZSH_ACTIVATED_VIRTUALENV" ]]; then
+    if [[ -n "$_ZSH_ACTIVATED_VIRTUALENV" && -n "$VIRTUAL_ENV" ]]; then
       if ! (( $#venv )) || [[ "$_ZSH_ACTIVATED_VIRTUALENV" != "$venv[1]" ]]; then
-        echo "De-activating virtualenv: $VIRTUAL_ENV" >&2
-        deactivate
         unset _ZSH_ACTIVATED_VIRTUALENV
+        echo "De-activating virtualenv: ${(D)VIRTUAL_ENV}" >&2
+        deactivate
       fi
     fi
 
     if [[ -z "$VIRTUAL_ENV" ]]; then
       if (( $#venv )); then
-        echo "Activating virtualenv: $venv" >&2
+        echo "Activating virtualenv: ${(D)venv}" >&2
         source $venv[1]/bin/activate
         _ZSH_ACTIVATED_VIRTUALENV="$venv[1]"
       fi