Created
October 29, 2013 12:55
-
-
Save drslump/7214114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Registers a hook when changing directory to find out the | |
# local pyenv version in it. Exporting it as PYENV_LOCAL_VERSION. | |
# | |
# Note that it's meant to only detect those directories using a .python-version | |
# | |
update-pyenv-local-version() { | |
# This will return something like "my-version (set by /path/to/.python-version)" | |
local version="`pyenv version`" | |
if [[ $version == *.python-version* ]]; then | |
export PYENV_LOCAL_VERSION=${version[(ws: :)1]} | |
else | |
export PYENV_LOCAL_VERSION="" | |
fi | |
} | |
autoload -U add-zsh-hook | |
add-zsh-hook chpwd update-pyenv-local-version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment