From d9831c2115c1e075c083c6145ff76283aa212acb Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Wed, 27 Sep 2017 09:40:01 +0200 Subject: [PATCH] Add shell function venv to activate python virtual environment --- .zshrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.zshrc b/.zshrc index 70fd666..7277db2 100644 --- a/.zshrc +++ b/.zshrc @@ -79,6 +79,16 @@ man () { command man "$@" } +venv() { + for d in venv/"$1" ve/"$1" ~/venv/"$1" + do + if [ -f "$d"/bin/activate ] + then + . "$d"/bin/activate + fi + done +} + source ~/.znewterm # assume pseudo terminals are from a "safe" terminal