Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 88 lines (68 sloc) 2.242 kb
4ce773a @jyurek Added bash config
authored
1 function parse_git_dirty {
2 [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo ''
3 }
4
5 function parse_git_branch {
3607fb6 @jyurek Make the branch display simpler
authored
6 git branch --no-color 2> /dev/null | grep \* | awk '{print $2}'
4ce773a @jyurek Added bash config
authored
7 }
8
9 function latest_command {
10 history | tail -n 1 | sed 's/[0-9 ]*\(.*\)/\1/'
11 }
12
13 function growl_latest_command {
4898778 @jyurek Growl should make a sticky, high priority alert when there is a non-zero...
authored
14 priority="Normal"
15 if (( $1 != 0 )); then
73b2eda @jyurek Different Growl notifications for exitcode == 0 and != 0
authored
16 priority="Emergency"
4898778 @jyurek Growl should make a sticky, high priority alert when there is a non-zero...
authored
17 fi
73b2eda @jyurek Different Growl notifications for exitcode == 0 and != 0
authored
18 latest_command | growlnotify -p $priority -n "Command Prompt $priority" `pwd` 1>/dev/null 2>&1
4ce773a @jyurek Added bash config
authored
19 }
20
21 function prompt_command_function
22 {
4898778 @jyurek Growl should make a sticky, high priority alert when there is a non-zero...
authored
23 last_result=$?
24 growl_latest_command $last_result
4ce773a @jyurek Added bash config
authored
25
4898778 @jyurek Growl should make a sticky, high priority alert when there is a non-zero...
authored
26 last_result="\[\e[33m\]$last_result\[\e[0m\]"
27 titlebar_last_command="\[\e]2;$(latest_command)\a\]"
4ce773a @jyurek Added bash config
authored
28
29 git_branch=$(parse_git_branch)
30 git_dirty= #$(parse_git_dirty)
31
32 git_dirty=${git_dirty:+" \[\e[31m\]$git_dirty\[\e[0m\]"}
33 git_branch=${git_branch:+" (\[\e[35m\]${git_branch}\[\e[0m\]${git_dirty})"}
34
35 PS1="$titlebar_last_command$last_result \h:\[\e[32m\]\w\[\e[0m\] \u$git_branch\$ "
36 }
37
38 function gemcd {
39 cd `dirname \`gem which $1\``
40 }
41
42 export PROMPT_COMMAND=prompt_command_function
43
ac895ef @jyurek Removed old stuff from bashrc, made brew location more flexible
authored
44 export BREW=/usr/local/bin/brew
4898778 @jyurek Growl should make a sticky, high priority alert when there is a non-zero...
authored
45 export PATH=`$BREW --prefix`/bin:`$BREW --prefix`/sbin:$HOME:$PATH:$HOME/bin:`$BREW --prefix`/Cellar/python/2.7/bin
4ce773a @jyurek Added bash config
authored
46 export EDITOR=/usr/bin/vim
47
48 export CDPATH=.:~:~/Development
49 alias ...='cd ../..'
50 alias ....='cd ../../..'
51 alias .....='cd ../../../..'
52
53 alias rerc='source ~/.bash_profile'
8b0a5d4 @jyurek Alias mvim to open new files in the same window, but new tab.
authored
54 alias mvim='mvim --servername VIM --remote-tab-silent'
4ce773a @jyurek Added bash config
authored
55
60664a7 @jyurek Removed and put in AWS account switching
authored
56 export AWS_ACCOUNT=jyurek
979c47d @jyurek Add a switching function for EY like the one for AWS
authored
57 function aws_account {
60664a7 @jyurek Removed and put in AWS account switching
authored
58 if [ -f $HOME/.aws/$1 ]; then
59 source $HOME/.aws/$1
60 export AWS_ACCOUNT=$1
61 else
62 echo "No AWS Credentials for $1"
63 fi
64 }
979c47d @jyurek Add a switching function for EY like the one for AWS
authored
65 aws_account $AWS_ACCOUNT
66
67 export EY_ACCOUNT=thoughtbot
68 function ey_account {
69 if [ -f $HOME/.ey/$1 ]; then
70 ln -sf $HOME/.ey/$1 $HOME/.eyrc
71 export EY_ACCOUNT=$1
72 else
73 echo "No EY Credentials for $1"
74 fi
75 }
76 ey_account $EY_ACCOUNT
60664a7 @jyurek Removed and put in AWS account switching
authored
77
ac895ef @jyurek Removed old stuff from bashrc, made brew location more flexible
authored
78 if [ -f `$BREW --prefix`/etc/bash_completion ]; then
79 . `$BREW --prefix`/etc/bash_completion
4ce773a @jyurek Added bash config
authored
80 fi
81
ac895ef @jyurek Removed old stuff from bashrc, made brew location more flexible
authored
82 if [ -f `$BREW --prefix`/etc/bash_completion.d/git-completion.bash ]; then
83 . `$BREW --prefix`/etc/bash_completion.d/git-completion.bash
4ce773a @jyurek Added bash config
authored
84 fi
85
ac895ef @jyurek Removed old stuff from bashrc, made brew location more flexible
authored
86 if [[ -s /Users/$USER/.rvm/scripts/rvm ]] ; then source /Users/$USER/.rvm/scripts/rvm ; fi
4ce773a @jyurek Added bash config
authored
87
Something went wrong with that request. Please try again.