Crops

Untitled

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