Guest User

Untitled

a guest
Dec 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. export CLICOLOR=1
  2. export LSCOLORS=ExFxBxDxCxegedabagacad
  3.  
  4. FG_RED="\033[38;5;9m"
  5. FG_YELLOW="\033[0;33m"
  6. FG_GREEN="\033[0;32m"
  7. FG_OCHRE="\033[38;5;110m"
  8. FG_BLUE="\033[0;34m"
  9. FG_WHITE="\033[0;37m"
  10. FG_RESET="\033[0m"
  11. FG_DARK_BLUE="\033[38;5;6m"
  12. FG_LIGHT_BLUE="\033[38;5;195m"
  13. RESET_ALL="\e[0m"
  14. NEWLINE="\n"
  15.  
  16. function git_color {
  17. local git_status="$(git status 2> /dev/null)"
  18. if [[ ! $git_status =~ "working tree clean" ]]; then
  19. echo -e $FG_RED
  20. elif [[ $git_status =~ "Your branch is ahead of" ]]; then
  21. echo -e $FG_YELLOW
  22. elif [[ $git_status =~ "nothing to commit" ]]; then
  23. echo -e $FG_GREEN
  24. else
  25. echo -e $FG_OCHRE
  26. fi
  27. }
  28.  
  29. function git_branch {
  30. local git_status="$(git status 2> /dev/null)"
  31. local on_branch="On branch ([^${IFS}]*)"
  32. local on_commit="HEAD detached at ([^${IFS}]*)"
  33.  
  34. if [[ $git_status =~ $on_branch ]]; then
  35. local branch=${BASH_REMATCH[1]}
  36. echo -e "$FG_WHITE ~ $(git_color)$branch$FG_WHITE"
  37. elif [[ $git_status =~ $on_commit ]]; then
  38. local commit=${BASH_REMATCH[1]}
  39. echo -e "$FG_WHITE ~ $(git_color)$commit$FG_WHITE"
  40. fi
  41. }
  42.  
  43. source ~/.bashd/venv_prompt.sh
  44.  
  45. # Enable the virtualenv
  46. function virtualenv_info(){
  47. # Get Virtual Env
  48. if [[ -n "$VIRTUAL_ENV" ]]; then
  49. # Strip out the path and just leave the env name
  50. venv="${VIRTUAL_ENV##*/}"
  51. py=`python --version 2>&1`
  52. else
  53. # In case you don't have one activated
  54. venv=''
  55. fi
  56. [[ -n "$venv" ]] && echo -e "$FG_WHITE[$FG_OCHRE$venv$FG_WHITE-$FG_YELLOW$py$FG_WHITE]"
  57. }
  58.  
  59. # disable the default virtualenv prompt change
  60. export VIRTUAL_ENV_DISABLE_PROMPT=1
  61. export PS1="\n\$(virtualenv_info)\$(git_branch)$RESET_ALL\n$FG_RED[$FG_WHITE\t$FG_RED] \u$FG_YELLOW@$FG_OCHRE\h $FG_DARK_BLUE[$FG_LIGHT_BLUE\w$FG_DARK_BLUE]$RESET_ALL\n"
  62.  
  63. # This is used to autochange to directory using virtualenv postactivate
  64. export PROJECT_FOLDER=~/Projects
Add Comment
Please, Sign In to add comment