]> git.r.bdr.sh - rbdr/dotfiles/blob - bash_profile
Autosign on git
[rbdr/dotfiles] / bash_profile
1 export PATH=/usr/local/bin:/usr/local/sbin:$PATH
2 export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
3
4 #Java HOME Adition
5 export JAVA_HOME=$(/usr/libexec/java_home)
6
7 export TERM=screen-256color
8
9 #git function
10 function _set_git_envar_info() {
11 GIT_BRANCH=""
12 GIT_PREFIX=""
13 GIT_STATE=""
14 CHECK_SHIT="lol"
15 RVM_COMMAND=$(rvm-prompt)
16 if [[ $RVM_COMMAND == "" ]]
17 then
18 RVM_COMMAND="system"
19 fi
20 if [ -f `which git` ];
21 then
22 local STATUS
23 STATUS=$(git status 2>/dev/null)
24 if [[ -z $STATUS ]]
25 then
26 return
27 fi
28 GIT_BRANCH="$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')"
29 if [[ -n "$GIT_BRANCH" ]]
30 then
31 GIT_PREFIX=" on "
32 fi
33 if [[ "$STATUS" == *'working directory clean'* ]]
34 then
35 GIT_STATE=""
36 else
37 GIT_STATE=""
38 if [[ "$STATUS" == *'Changes to be committed:'* ]]
39 then
40 GIT_STATE='!' # Index has files staged for commit
41 fi
42 if [[ "$STATUS" == *'Changed but not updated:'* ]]
43 then
44 GIT_STATE="?" # Working tree has files modified but unstaged
45 fi
46 if [[ "$STATUS" == *'Untracked files:'* ]]
47 then
48 GIT_STATE='?' # Working tree has untracked files
49 fi
50 fi
51 fi
52 }
53
54 export -f _set_git_envar_info
55
56 #this thing for my prompt.
57 export PROMPT_COMMAND="_set_git_envar_info"
58 export PS1='\[\e[0;31m\]\u\[\e[0m\] at \[\e[0;33m\]\h\[\e[0m\] in \[\e[0;32m\]\w\[\e[0m\]$GIT_PREFIX\[\e[1;34m\]$GIT_BRANCH\[\e[0m\]\[\e[0;32m\]$GIT_STATE \[\e[0;30m\]($RVM_COMMAND) \[\e[0m\] \n\$ '
59
60 #display fortune when I start
61 echo -e "\033[30m"
62 /usr/local/bin/fortune
63 echo -e "\033[m"
64
65 #Editor.
66 export EDITOR="vim"
67 export VISUAL="vim"
68
69 #some aliases.
70 alias dwarffortress="/Applications/Dwarf\ Fortress/df"
71 alias ls="ls -FG"
72 alias rspec="rspec --color"
73
74 #Git utility aliases
75 alias gpsc="git push origin $GIT_BRANCH"
76 alias gplc="git pull origin $GIT_BRANCH"
77
78 #Enable Bash Completion
79 if [ -f `brew --prefix`/etc/bash_completion ]; then
80 . `brew --prefix`/etc/bash_completion
81 fi
82
83 #Screeninator and RVM scripts
84 [[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
85