Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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