1
0
Fork 0
mirror of https://github.com/hcartiaux/dotfiles.git synced 2024-10-18 17:25:23 +02:00
dotfiles/direnv/init.sh
2020-05-13 18:48:50 +02:00

20 lines
521 B
Bash

# Custom load for direnv
# See https://direnv.net/
if [ -n "$(which direnv 2>/dev/null)" ]; then
eval "$(direnv hook $(basename $SHELL))"
# See https://github.com/direnv/direnv/wiki/Python#restoring-the-ps
show_virtual_env() {
if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then
echo "($(basename $VIRTUAL_ENV))"
fi
}
if [[ -n ${ZSH_VERSION-} ]]; then
setopt PROMPT_SUBST
else
export -f show_virtual_env
fi
PS1='$(show_virtual_env) '$PS1
fi