Created
August 27, 2016 09:54
-
-
Save chew-z/64af095a0c48f2a9244fe2af6f0be5e6 to your computer and use it in GitHub Desktop.
Lazy loading virtualenv in zsh
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
# virtualenvwrapper | |
# lazy loading saves on shell startup time | |
workon() { | |
[ -z "$PROJECT_HOME" ] && { | |
unset -f workon; | |
export WORKON_HOME=$HOME/.virtualenvs; | |
export PROJECT_HOME=$HOME/Documents/Python; | |
source /usr/local/bin/virtualenvwrapper.sh | |
} | |
workon "$@" | |
} | |
# I have shaved c.a. 0.6-0.7 sec on terminal/zsh/oh-my-zsh startup | |
# 0.4sec through some cleanup in .zshrc - fpath, getting rid of compinit | |
# Another 0.3sec through this code which lazy loads virtualenv wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment