Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. export CLICOLOR=1
  2. export LSCOLORS=GxFxCxDxBxegedabagaced
  3. export PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"'
  4. #export PS1="\[$(tput setaf 64)\]\h\[$(tput setaf 33)\]@\u\[$(tput setaf 71)\]$ $(tput sgr0)"
  5.  
  6. echo "Loding from .bash_profile..!!"
  7. source ~/scripts/git-completion.bash
  8.  
  9. [[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
  10.  
  11. [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
  12.  
  13.  
  14. function myip() {
  15. ifconfig lo0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "lo0 : " $2}'
  16. ifconfig en0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en0 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
  17. ifconfig en0 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en0 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
  18. ifconfig en1 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en1 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
  19. ifconfig en1 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en1 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
  20. }
  21.  
  22.  
  23. # Get the current git branch name (if available)
  24. git_prompt() {
  25. local ref=$(git symbolic-ref HEAD 2>/dev/null | cut -d'/' -f3)
  26. if [ "$ref" != "" ]
  27. then
  28. echo "[$ref$(parse_git_dirty)$(parse_git_stash)]"
  29. fi
  30. }
  31.  
  32.  
  33. # Returns "*" if the current git branch is dirty.
  34. function parse_git_dirty {
  35. [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] && echo "*"
  36. }
  37.  
  38. # Returns "|shashed:N" where N is the number of stashed states (if any).
  39. function parse_git_stash {
  40. local stash=`expr $(git stash list 2>/dev/null| wc -l)`
  41. if [ "$stash" != "0" ]
  42. then
  43. echo "|stashed:$stash"
  44. fi
  45. }
  46.  
  47. export MYPS='$(echo -n "${PWD/#$HOME/~}" | awk -F "/" '"'"'{
  48. if (length($0) > 14) { if (NF>4) print $1 "/" $2 "/.../" $(NF-1) "/" $NF;
  49. else if (NF>3) print $1 "/" $2 "/.../" $NF;
  50. else print $1 "/.../" $NF; }
  51. else print $0;}'"'"')'
  52.  
  53.  
  54. #export PS1='\[$(tput setaf 64)\]\h\[$(tput setaf 33)\]@\u\[$(tput setaf 7)\]$(git_branch)$(tput sgr0)$ $(tput sgr0)'
  55. export PS1='\[$(tput setaf 64)\]\h\[$(tput setaf 33)\]@\u\[$(tput setaf 64)\][$(eval "echo ${MYPS}")]$(tput setaf 7)\]$(git_prompt)$(tput sgr0)$ $(tput sgr0)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement