Last active
September 20, 2018 00:50
-
-
Save avidit/dfbe8aafdf2ced07cd2a4dcff9ba61a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bash_prompt { | |
# color | |
GREEN='\[\e[0;32m\]' | |
BLUE='\[\e[0;34m\]' | |
RESET='\[\e[0m\]' | |
# working dir | |
PROMPT="\W" | |
# git | |
if type "__git_ps1" > /dev/null 2>&1; then | |
PROMPT="$PROMPT$(__git_ps1 "${GREEN}(%s)${RESET}")" | |
fi | |
# virtualenv | |
if [[ $VIRTUAL_ENV != "" ]]; then | |
PROMPT="$PROMPT${BLUE}{${VIRTUAL_ENV##*/}}${RESET}" | |
fi | |
PS1="$PROMPT\$ " | |
} | |
export -f bash_prompt | |
# Bash shell executes this function just before displaying the PS1 variable | |
export PROMPT_COMMAND='bash_prompt' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment