Crops

profile

Aug 10th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. # Customize BASH PS1 prompt to show current GIT repository and branch.
  2. # by Mike Stewart - http://MediaDoneRight.com
  3.  
  4. # SETUP CONSTANTS
  5. # Bunch-o-predefined colors. Makes reading code easier than escape sequences.
  6. # I don't remember where I found this. o_O
  7.  
  8. # Reset
  9. Color_Off="\[\033[0m\]" # Text Reset
  10.  
  11. # Regular Colors
  12. Black="\[\033[0;30m\]" # Black
  13. Red="\[\033[0;31m\]" # Red
  14. Green="\[\033[0;32m\]" # Green
  15. Yellow="\[\033[0;33m\]" # Yellow
  16. Blue="\[\033[0;34m\]" # Blue
  17. Purple="\[\033[0;35m\]" # Purple
  18. Cyan="\[\033[0;36m\]" # Cyan
  19. White="\[\033[0;37m\]" # White
  20.  
  21. # Bold
  22. BBlack="\[\033[1;30m\]" # Black
  23. BRed="\[\033[1;31m\]" # Red
  24. BGreen="\[\033[1;32m\]" # Green
  25. BYellow="\[\033[1;33m\]" # Yellow
  26. BBlue="\[\033[1;34m\]" # Blue
  27. BPurple="\[\033[1;35m\]" # Purple
  28. BCyan="\[\033[1;36m\]" # Cyan
  29. BWhite="\[\033[1;37m\]" # White
  30.  
  31. # Underline
  32. UBlack="\[\033[4;30m\]" # Black
  33. URed="\[\033[4;31m\]" # Red
  34. UGreen="\[\033[4;32m\]" # Green
  35. UYellow="\[\033[4;33m\]" # Yellow
  36. UBlue="\[\033[4;34m\]" # Blue
  37. UPurple="\[\033[4;35m\]" # Purple
  38. UCyan="\[\033[4;36m\]" # Cyan
  39. UWhite="\[\033[4;37m\]" # White
  40.  
  41. # Background
  42. On_Black="\[\033[40m\]" # Black
  43. On_Red="\[\033[41m\]" # Red
  44. On_Green="\[\033[42m\]" # Green
  45. On_Yellow="\[\033[43m\]" # Yellow
  46. On_Blue="\[\033[44m\]" # Blue
  47. On_Purple="\[\033[45m\]" # Purple
  48. On_Cyan="\[\033[46m\]" # Cyan
  49. On_White="\[\033[47m\]" # White
  50.  
  51. # High Intensty
  52. IBlack="\[\033[0;90m\]" # Black
  53. IRed="\[\033[0;91m\]" # Red
  54. IGreen="\[\033[0;92m\]" # Green
  55. IYellow="\[\033[0;93m\]" # Yellow
  56. IBlue="\[\033[0;94m\]" # Blue
  57. IPurple="\[\033[0;95m\]" # Purple
  58. ICyan="\[\033[0;96m\]" # Cyan
  59. IWhite="\[\033[0;97m\]" # White
  60.  
  61. # Bold High Intensty
  62. BIBlack="\[\033[1;90m\]" # Black
  63. BIRed="\[\033[1;91m\]" # Red
  64. BIGreen="\[\033[1;92m\]" # Green
  65. BIYellow="\[\033[1;93m\]" # Yellow
  66. BIBlue="\[\033[1;94m\]" # Blue
  67. BIPurple="\[\033[1;95m\]" # Purple
  68. BICyan="\[\033[1;96m\]" # Cyan
  69. BIWhite="\[\033[1;97m\]" # White
  70.  
  71. # High Intensty backgrounds
  72. On_IBlack="\[\033[0;100m\]" # Black
  73. On_IRed="\[\033[0;101m\]" # Red
  74. On_IGreen="\[\033[0;102m\]" # Green
  75. On_IYellow="\[\033[0;103m\]" # Yellow
  76. On_IBlue="\[\033[0;104m\]" # Blue
  77. On_IPurple="\[\033[10;95m\]" # Purple
  78. On_ICyan="\[\033[0;106m\]" # Cyan
  79. On_IWhite="\[\033[0;107m\]" # White
  80.  
  81. # Various variables you might want for your PS1 prompt instead
  82. Time12h="\T"
  83. Time12a="\@"
  84. PathShort="\w"
  85. PathFull="\W"
  86. NewLine="\n"
  87. Jobs="\j"
  88.  
  89.  
  90. # This PS1 snippet was adopted from code for MAC/BSD I saw from: http://allancraig.net/index.php?option=com_content&view=article&id=108:ps1-export-command-for-git&catid=45:general&Itemid=96
  91. # I tweaked it to work on UBUNTU 11.04 & 11.10 plus made it mo' better
  92.  
  93. # This PS1 snippet was adopted from code for MAC/BSD I saw from: http://allancraig.net/index.php?option=com_content&view=article&id=108:ps1-export-command-for-git&catid=45:general&Itemid=96
  94. # I tweaked it to work on UBUNTU 11.04 & 11.10 plus made it mo' better
  95. # $IBlack$Time12h
  96. export PS1=$Color_Off'$(git branch &>/dev/null;\
  97. if [ $? -eq 0 ]; then \
  98. echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \
  99. if [ "$?" -eq "0" ]; then \
  100. # @4 - Clean repository - nothing to commit
  101. echo "'$PathFull' '$Green'"$(__git_ps1 "(%s)"); \
  102. else \
  103. # @5 - Changes to working tree
  104. echo "'$PathFull' '$IRed'"$(__git_ps1 "{%s}"); \
  105. fi) '$BWhite$Color_Off'> "; \
  106. else \
  107. # @2 - Prompt when not in GIT repo
  108. echo "'$BWhite$PathShort$Color_Off' > "; \
  109. fi)'
  110. alias mysql='winpty mysql'
  111. alias subl='/c/Program\ Files/Sublime\ Text\ 3/./subl.exe'
  112. alias bitbucket="cd ~/Documents/Bitbucket/"
Add Comment
Please, Sign In to add comment