From 0445ad9f57b2402bb0030046c96dce6a3745d989 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 6 Feb 2013 11:44:04 +0100 Subject: zsh: Add venv function This enables or lists virtual environments --- .zsh/functions/Makefile | 2 +- .zsh/functions/venv | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .zsh/functions/venv (limited to '.zsh/functions') diff --git a/.zsh/functions/Makefile b/.zsh/functions/Makefile index 670c57c..baf5c6b 100644 --- a/.zsh/functions/Makefile +++ b/.zsh/functions/Makefile @@ -2,6 +2,6 @@ DESTDIR:=$(DESTDIR)/functions objects=chpwd_show_todo chpwd_update_git_vars env get_cnt line \ precmd_maybe_festival precmd_update_git_vars precmd_update_updates \ preexec_update_vars prompt prompt_git_info rprompt \ - update_current_git_vars welcome + update_current_git_vars welcome venv include ../../dotfiles.mk diff --git a/.zsh/functions/venv b/.zsh/functions/venv new file mode 100644 index 0000000..49564ac --- /dev/null +++ b/.zsh/functions/venv @@ -0,0 +1,15 @@ +# -*- mode: sh; -*- +if [ "${#}" -eq 1 ]; then + venv_activate="$HOME/.virtualenv/$1/bin/activate" + + if [ -r "$venv_activate" ]; then + source $venv_activate + else + echo "$1 is not a know virtual environment" + fi +else + echo "Virtual environments: " + for itm in ~/.virtualenv/*; do + echo " $(basename $itm)" + done +fi -- cgit v1.2.3-54-g00ecf