]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - README.md
tests: simplify ZDOTDIR setup, remove base
[zsh-autoenv.git] / README.md
index e39ab7e280877c8c4a0025430e07ce9976a63c5f..c49e66fe78ec206ce330b65add38c57a9a9ec8d0 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,5 +1,3 @@
-[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/Tarrasch/zsh-autoenv/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
-
 [![Build Status](https://travis-ci.org/Tarrasch/zsh-autoenv.svg?branch=master)](https://travis-ci.org/Tarrasch/zsh-autoenv)
 
 # Autoenv for Zsh
@@ -10,16 +8,20 @@ typically used in project root directories.
 It handles "enter" and leave" events, nesting, and stashing of
 variables (overwriting and restoring).
 
+## Requirements
+
+- Zsh version 4.3.10 or later.
+
 ## Features
 
- - Support for enter and leave events, which can use the same file.
-   By default `.autoenv.zsh` is used for entering, and `.autoenv_leave.zsh`
-   for leaving.
- - Interactively asks for confirmation / authentication before sourcing an
-   unknown `.autoenv.zsh` file, and remembers whitelisted files by their
-   hashed content.
- - Test suite.
- - Written in Zsh.
+- Support for enter and leave events, which can use the same file.
+  By default it uses `.autoenv.zsh` for entering, and `.autoenv_leave.zsh`
+  for leaving.
+- Interactively asks for confirmation / authentication before sourcing an
+  unknown `.autoenv.zsh` file, and remembers whitelisted files by their
+  hashed content.
+- Test suite.
+- Written in/for Zsh.
 
 ### Variable stashing
 
@@ -52,7 +54,6 @@ have more control.
 
 The varstash library has been taken from smartcd, and was optimized for Zsh.
 
-
 ## Writing your .autoenv.zsh file
 
 ### `autoenv_source_parent()`
@@ -96,35 +97,41 @@ Add the following to your `.zshrc` where you are loading your plugins:
 You can use the following variables to control zsh-autoenv's behavior.
 Add them to your `~/.zshrc` file, before sourcing/loading zsh-autoenv.
 
-### AUTOENV\_FILE\_ENTER
+### AUTOENV_FILE_ENTER
+
 Name of the file to look for when entering directories.
 
 Default: `.autoenv.zsh`
 
-### AUTOENV\_FILE\_LEAVE
+### AUTOENV_FILE_LEAVE
+
 Name of the file to look for when leaving directories.
 Requires `AUTOENV_HANDLE_LEAVE=1`.
 
 Default: `.autoenv_leave.zsh`
 
-### AUTOENV\_LOOK\_UPWARDS
+### AUTOENV_LOOK_UPWARDS
+
 Look for zsh-autoenv "enter" files in parent dirs?
 
 Default: `1`
 
-### AUTOENV\_HANDLE\_LEAVE
+### AUTOENV_HANDLE_LEAVE
+
 Handle leave events when changing away from a subtree, where an "enter"
 event was handled?
 
 Default: `1`
 
-### AUTOENV\_DISABLED
+### AUTOENV_DISABLED
+
 (Temporarily) disable zsh-autoenv. This gets looked at in the chpwd handler.
 
 Default: 0
 
-### AUTOENV\_DEBUG
-Enable debugging. Multiple levels are supported (max 2).
+### AUTOENV_DEBUG
+
+Set debug level. If enabled (> 0) it will print information to stderr.
 
 - 0: no debug messages
 - 1: generic debug logging
@@ -135,6 +142,13 @@ Enable debugging. Multiple levels are supported (max 2).
 
 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
@@ -159,19 +173,19 @@ if [[ $autoenv_event == 'enter' ]]; then
 
     setopt localoptions extendedglob
     local -a venv
-    venv=(./(../)#.venv(NY1:A))
+    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
@@ -186,10 +200,10 @@ fi
 ```
 
 ## Related projects
-- https://github.com/direnv/direnv
-- https://github.com/cxreg/smartcd
-- https://github.com/kennethreitz/autoenv
 
+- <https://github.com/direnv/direnv>
+- <https://github.com/cxreg/smartcd>
+- <https://github.com/kennethreitz/autoenv>
 
 ## History
 
@@ -201,7 +215,7 @@ The code was initially based on
 [@joshuaclayton](https://github.com/joshuaclayton)'s dotfiles.
 In September 2013 [@Tarrasch](https://github.com/Tarrasch) packaged it into a
 nice [antigen]-compatible unit with integration tests. Since November 2014,
-[@blueyed](https://github.com/blueyed) took over and added many many nice
+[@blueyed](https://github.com/blueyed) took over and added many nice
 features, mainly inspired by [smartcd].
 
 [antigen]: https://github.com/Tarrasch/antigen-hs