Guest User

Untitled

a guest
Apr 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Put this in .bashrc.
  2. Shows current Git branch, like this: ~/rails/hamlyzer(master)$
  3.  
  4. ----------------------------------------
  5.  
  6. function parse_git_branch {
  7. git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
  8. }
  9.  
  10. function proml {
  11. local BLUE="\[\033[0;34m\]"
  12. local RED="\[\033[0;31m\]"
  13. local LIGHT_RED="\[\033[1;31m\]"
  14. local GREEN="\[\033[0;32m\]"
  15. local LIGHT_GREEN="\[\033[1;32m\]"
  16. local WHITE="\[\033[1;37m\]"
  17. local LIGHT_GRAY="\[\033[0;37m\]"
  18. case $TERM in
  19. xterm*)
  20. TITLEBAR='\[\033]0;\u@\h:\w\007\]'
  21. ;;
  22. *)
  23. TITLEBAR=""
  24. ;;
  25. esac
  26.  
  27. PS1="${TITLEBAR}\
  28. $LIGHT_GRAY\u@\h:\w$GREEN\$(parse_git_branch)\
  29. $LIGHT_GRAY\$ "
  30. PS2='> '
  31. PS4='+ '
  32. }
  33. proml
Add Comment
Please, Sign In to add comment