Guest User

Untitled

a guest
Oct 21st, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. # print the git info for a directory
  2. __git_branch() {
  3. if __has_parent_dir ".git"; then
  4. echo "-[$(git rev-parse --abbrev-ref HEAD)]";
  5. fi
  6. }
  7.  
  8. # print the directory name
  9. # some custom logic to shorten certain paths for readability
  10. __directory_name() {
  11. directory="$(pwd)"
  12. echo "$directory";
  13. }
  14.  
  15. # print the host name or whatever you'd like to see there
  16. # in my case i'm using a short abbreviation as my hostname is long and ugly
  17. __hostname() {
  18. echo "pegasus";
  19. }
  20.  
  21. # COLOR SCHEME
  22. black=$(tput -Txterm setaf 0)
  23. red=$(tput -Txterm setaf 1)
  24. green=$(tput -Txterm setaf 2)
  25. yellow=$(tput -Txterm setaf 3)
  26. dk_blue=$(tput -Txterm setaf 4)
  27. pink=$(tput -Txterm setaf 5)
  28. lt_blue=$(tput -Txterm setaf 6)
  29.  
  30. bold=$(tput -Txterm bold)
  31. reset=$(tput -Txterm sgr0)
  32.  
  33. # Nicely formatted terminal prompt
  34. export PS1='\n\[$bold\]\[$black\][\[$dk_blue\]\@\[$black\]]-[\[$green\]\u\[$yellow\]@\[$green\]$(__hostname) \[$black\]]-[\[$pink\]$(__directory_name) \[$black\]]\[\033[0;33m\]$(__git_branch) \[\033[00m\]\[$reset\]\n\[$reset\]\$ '
  35.  
  36. # grep colors
  37. export GREP_OPTIONS='--color=auto'
  38. export GREP_COLOR='1;35;40'
Add Comment
Please, Sign In to add comment