Guest User

Untitled

a guest
Jul 18th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.46 KB | None | 0 0
  1.  
  2. export USER="tomas-stefano"
  3.  
  4. # Colours
  5. export BLUE="\[\033[0;34m\]"
  6. export NO_COLOR="\[\e[0m\]"
  7. export GRAY="\[\033[1;30m\]"
  8. export GREEN="\[\033[0;32m\]"
  9. export LIGHT_GRAY="\[\033[0;37m\]"
  10. export LIGHT_GREEN="\[\033[1;32m\]"
  11. export LIGHT_RED="\[\033[1;31m\]"
  12. export RED="\[\033[0;31m\]"
  13. export WHITE="\[\033[1;37m\]"
  14. export YELLOW="\[\033[0;33m\]"
  15.  
  16. # ls and grep colorize
  17. export GREP_OPTIONS="--color=auto"
  18. export GREP_COLOR="4;33"
  19. export CLICOLOR="auto"
  20. export GEM_EDITOR="mate"
  21.  
  22. alias ls='ls -G'
  23.  
  24. alias textmate_rails="mate app config db features lib public spec Tasks"
  25.  
  26. alias cd_gems="cd ~/Codigos/Ruby/gems/"
  27.  
  28. alias cd_libs="cd ~/Codigos/C/"
  29.  
  30. alias mysqlraw="mysql -u tdestefi -p -h 69.46.19.48 raw"
  31. alias server_infoplex="ssh -v tdestefi@69.46.19.62"
  32.  
  33. alias jsonget="curl -X GET -H 'Accept: application/json'"
  34.  
  35. alias databases_mate="mate ~/Codigos/C/mongo ~/Codigos/C/couchdb ~/Codigos/C/DruidDB ~/Codigos/C/redis-2.0.3"
  36.  
  37. alias start_redis="redis-server /usr/local/etc/redis.conf"
  38.  
  39. alias read_ruby_source_code="mate ~/.rvm/src/ruby-1.9.2-p0/"
  40.  
  41. alias gem_uninstall_all="gem list | cut -d\" \" -f1 | fgrep -v bundler | fgrep -v rake | fgrep -v rdoc | xargs gem uninstall -aIx"
  42.  
  43.  
  44. # Projetos
  45. alias infoplex_prepare='cd ~/Projetos/Infoplex && clear'
  46. alias rubycasts="cd ~/Projetos/rubycasts && ls"
  47. alias reblog="cd ~/Projetos/reblog && ls"
  48.  
  49. # Set window title
  50. title() {
  51. echo -ne "\033]0;$@\007";
  52. }
  53.  
  54. # list directory after cd; also save the last directory
  55. # and open it when a new tab is created.
  56. cd() {
  57. builtin cd "${@:-$HOME}" && ls && pwd > $CDHISTORY;
  58.  
  59. if [ -f .rvmrc ]; then
  60. __rvm_project_rvmrc
  61. fi
  62. }
  63.  
  64. github() {
  65. if [ $# = 1 ]; then
  66. git clone git@github.com:$USER/$1.git;
  67. builtin cd $1 && ls;
  68. elif [ $# = 2 ]; then
  69. git clone git://github.com/$1/$2.git;
  70. builtin cd $2 && ls;
  71. else
  72. echo "Usage:";
  73. echo " github <repo> ~> will clone $USER's <repo>";
  74. echo " github <user> <repo> ~> will clone <user>'s <repo>";
  75. fi
  76. }
  77.  
  78. custom_prompt () {
  79. local BRANCH=`git branch 2> /dev/null | grep \* | sed 's/* //'`
  80.  
  81. if [[ "$BRANCH" = "" ]]; then
  82. BRANCH=`git status 2> /dev/null | grep "On branch" | sed 's/# On branch //'`
  83. fi
  84.  
  85. local RUBY_VERSION=`ruby -e "puts RUBY_VERSION"`
  86. local GEMSET_NAME=`rvm gemset name`
  87. local RUBY_PROMPT=""
  88. local STATUS=`git status 2>/dev/null`
  89. local PROMPT_COLOR=$GREEN
  90. local STATE=" "
  91. local NOTHING_TO_COMMIT="# Initial commit"
  92. local BEHIND="# Your branch is behind"
  93. local AHEAD="# Your branch is ahead"
  94. local UNTRACKED="# Untracked files"
  95. local DIVERGED="have diverged"
  96. local CHANGED="# Changed but not updated"
  97. local TO_BE_COMMITED="# Changes to be committed"
  98. local LOG=`git log -1 2> /dev/null`
  99.  
  100. if [[ "$GEMSET_NAME" != "" ]]; then
  101. RUBY_PROMPT="${RED}(ruby-${RUBY_VERSION}@${GEMSET_NAME})${NO_COLOR} "
  102. else
  103. RUBY_PROMPT="${RED}(ruby-${RUBY_VERSION})${NO_COLOR} "
  104. fi
  105.  
  106. if [ "$STATUS" != "" ]; then
  107. if [[ "$STATUS" =~ "$NOTHING_TO_COMMIT" ]]; then
  108. PROMPT_COLOR=$RED
  109. STATE=""
  110. elif [[ "$STATUS" =~ "$DIVERGED" ]]; then
  111. PROMPT_COLOR=$RED
  112. STATE="${STATE}${RED}↕${NO_COLOR}"
  113. elif [[ "$STATUS" =~ "$BEHIND" ]]; then
  114. PROMPT_COLOR=$RED
  115. STATE="${STATE}${RED}↓${NO_COLOR}"
  116. elif [[ "$STATUS" =~ "$AHEAD" ]]; then
  117. PROMPT_COLOR=$RED
  118. STATE="${STATE}${RED}↑${NO_COLOR}"
  119. elif [[ "$STATUS" =~ "$CHANGED" ]]; then
  120. PROMPT_COLOR=$RED
  121. STATE=""
  122. elif [[ "$STATUS" =~ "$TO_BE_COMMITED" ]]; then
  123. PROMPT_COLOR=$RED
  124. STATE=""
  125. else
  126. PROMPT_COLOR=$GREEN
  127. STATE=""
  128. fi
  129.  
  130. if [[ "$STATUS" =~ "$UNTRACKED" ]]; then
  131. STATE="${STATE}${YELLOW}*${NO_COLOR}"
  132. fi
  133.  
  134. PS1=" ${RUBY_PROMPT}${YELLOW}\w\a${NO_COLOR} (${PROMPT_COLOR}${BRANCH}${NO_COLOR}${STATE}${NO_COLOR})\n⤷ "
  135. else
  136. PS1=" ${RUBY_PROMPT}${YELLOW}\w\a${NO_COLOR}\n⤷ "
  137. fi
  138. }
  139. source ~/.git_completion.sh
  140.  
  141. #PS1='\n[\u] \[\033[1;33m\]\w\a\[\033[0m\]$(__git_ps1 "
  142. # \[\033[1;32m\](%s)\[\033[0m\]")\n\$ '
  143.  
  144. #export PS1='\[\033[38m\]\u\[\033[32m\] \w \[\033[1;33m\]`~/.rvm/bin/rvm-prompt i v
  145. #`\[\033[0;31m\] `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\
  146. #\(.+\)$/\(\\\\\1\)\ /
  147. #`\[\033[37m\]$\[\033[00m\] '
  148.  
  149. PROMPT_COMMAND=custom_prompt
  150.  
  151. # export PS1="\033[32m\]\w \[\033[1;33m\]\$(rvm_version)\[\033[0;31m\]\$(parse_git_branch)
  152. # \033[0m "
  153.  
  154. #PS1='\n[\u] \[\033[1;34m\]\w\a\[\033[0m\]$(__git_ps1 "
  155. # \[\033[1;32m\](%s)\[\033[0m\]")\n\$ '
  156.  
  157. # rvm-install added:
  158. if [[ -s /Users/tomas/.rvm/scripts/rvm ]] ; then source /Users/tomas/.rvm/scripts/rvm ; fi
  159.  
  160. source ~/.profile
Add Comment
Please, Sign In to add comment