Skip to content

Instantly share code, notes, and snippets.

@jwalsh
Created July 15, 2019 20:02
Show Gist options
  • Save jwalsh/fcb1ee0bd0e2c89c8a024006a646783d to your computer and use it in GitHub Desktop.
Save jwalsh/fcb1ee0bd0e2c89c8a024006a646783d to your computer and use it in GitHub Desktop.
export PATH="/usr/local/sbin:$PATH"
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs'
if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
__GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share
GIT_PROMPT_ONLY_IN_REPO=1
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
fi
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion" # This loads nvm bash_completion
export PATH=~/.local/bin:$PATH
# Activate current folder's pipenv virtualenv
# or accept an explicit virtualenv name
workon() {
if [ $# -eq 0 ]
then
source "$(pipenv --venv)/bin/activate"
else
source "~/.virtualenvs/$1/bin/activate"
fi
}
# Making virtualenv alias
mkvenv() {
cd ~/.virtualenvs
virtualenv "$@"
cd -
workon "$1"
}
# Automatic virtualenv sourcing
function auto_pipenv_shell {
if [ ! -n "$VIRTUAL_ENV" ]; then
if [ -f "Pipfile" ] ; then
workon
fi
fi
}
function cd {
builtin cd "$@"
auto_pipenv_shell
}
auto_pipenv_shell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment