Skip to content

Commit 7a8deae

Browse files
committed
Added more features for venv management.
1) Will now exit vnev when it has outlived its usefullness. 2) Better parsing of venv name.
1 parent 78e5185 commit 7a8deae

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

bash/myprompt.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ function ps1_real() {
8585
# fi
8686

8787
# load venv
88+
if [ -e "${VIRTUAL_ENV}" ]; then
89+
if [[ ! "$(pwd)" =~ "$(dirname ${VIRTUAL_ENV})".* ]]; then
90+
echo "Leaving Python Virtual Environment."
91+
deactivate
92+
fi
93+
fi
8894
if [ ! -e "${VIRTUAL_ENV}" ]; then
8995
source $(_find_venv) &> /dev/null
9096
fi
@@ -93,7 +99,7 @@ function ps1_real() {
9399

94100
# get the python virtualenv
95101
if [ "$VIRTUAL_ENV" != "" ]; then
96-
venv=$(basename $(dirname $VIRTUAL_ENV))/$(basename $VIRTUAL_ENV)
102+
venv=$(echo $(basename $VIRTUAL_ENV) | grep -v '^\.' || echo $(basename $(dirname $VIRTUAL_ENV)))
97103
PS1_VENV="${_BG_YELLOW}${_FG_CYAN}[ ${venv} ]"
98104
elif [ "$CONDA_PROMPT_MODIFIER" != "" ]; then
99105
PS1_VENV="${_BG_YELLOW}${_FG_CYAN} ${CONDA_PROMPT_MODIFIER}"

vim/vimrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ hi NonText ctermbg=none
5353

5454
" show line number and lengths
5555
set number " show line number
56-
set tw=79 " width of document
56+
set tw=119 " width of document
5757
set nowrap " don't automatically wrap on load
5858
set fo-=t " don't automatically wrap while typing
59-
set colorcolumn=79
59+
set colorcolumn=119
6060
highlight ColorColumn ctermbg=233
6161

6262
" paragraph formatting

0 commit comments

Comments
 (0)