thorpedosg

Untitled

Jul 24th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # bash-completion
  2. if [ -f `brew --prefix`/etc/bash_completion ]; then
  3. . `brew --prefix`/etc/bash_completion
  4. fi
  5.  
  6. rvm_status() {
  7. rvm_info=$(~/.rvm/bin/rvm-prompt)
  8. if [ -n "$rvm_info" ]; then
  9. echo "($rvm_info)"
  10. fi
  11. }
  12.  
  13. function parse_git_deleted {
  14. [[ $(git status 2> /dev/null | grep deleted:) != "" ]] && echo "-"
  15. }
  16. function parse_git_added {
  17. [[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+'
  18. }
  19. function parse_git_modified {
  20. [[ $(git status 2> /dev/null | grep modified:) != "" ]] && echo "*"
  21. }
  22. function parse_git_dirty {
  23. # [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "☠"
  24. echo "$(parse_git_added)$(parse_git_modified)$(parse_git_deleted)"
  25. }
  26. function parse_git_branch {
  27. git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
  28. }
  29.  
  30. # bash PS1
  31. export PS1='\n\w $(rvm_status) $(parse_git_branch)\n$ '
  32.  
  33. # coloring
  34. export CLICOLOR=1
  35. export LSCOLORS=ExFxCxDxBxegedabagacad
Add Comment
Please, Sign In to add comment