#add following code to /etc/bash_completion.d/workon (ADAPT YOUR VIRTUALENV DIRECTORY)
_codeComplete()
{
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "$(ls --color=never /home/slavi/virtualenvs/)" -- $cur) )
}
complete -F _codeComplete workon
# add following code to your .bashrc or .bash_aliases
workon(){
DIR="/home/slavi/virtualenvs/"
if [ "$1" = "" ];then
echo "workon <virtualenv to activate> or choose virtualenv from list:" ;
declare -a virtlist=(`ls --color=never $DIR`)
c=${#virtlist[@]}
for (( i=0; i<=$c; i++ )); do
echo -e "$i ${virtlist[$i]\n}"
done
read this
VIRT="${virtlist[$this]}"
echo $VIRT
source "/home/slavi/virtualenvs/$VIRT/bin/activate"
cd "/home/slavi/virtualenvs/$VIRT"
return
fi
source "/home/slavi/virtualenvs/$1/bin/activate"
cd "/home/slavi/virtualenvs/$1"
}