Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 98 lines (76 sloc) 2.511 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-z…
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-z…
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-z…
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-z…
authored
30 last_result="\[\e[33m\]$last_result\[\e[0m\]"
31 titlebar_last_command="\[\e]2;$(latest_command)\a\]"
33d2eec @jyurek Added rvm status to prompt
authored
32 rvm_prompt="\[\e[33m\]$(rvm-prompt s i v p g)\[\e[0m\]"
4ce773a @jyurek Added bash config
authored
33
34 git_branch=$(parse_git_branch)
a0fdae7 @jyurek Added hgrc
authored
35 hg_branch=$(parse_hg_branch)
4ce773a @jyurek Added bash config
authored
36 git_dirty= #$(parse_git_dirty)
a0fdae7 @jyurek Added hgrc
authored
37 hg_dirty=
4ce773a @jyurek Added bash config
authored
38
39 git_dirty=${git_dirty:+" \[\e[31m\]$git_dirty\[\e[0m\]"}
40 git_branch=${git_branch:+" (\[\e[35m\]${git_branch}\[\e[0m\]${git_dirty})"}
a0fdae7 @jyurek Added hgrc
authored
41 hg_branch=${hg_branch:+" (\[\e[36m\]${hg_branch}\[\e[0m\]${hg_dirty})"}
4ce773a @jyurek Added bash config
authored
42
33d2eec @jyurek Added rvm status to prompt
authored
43 PS1="$titlebar_last_command$last_result \h:\[\e[32m\]\w\[\e[0m\] $rvm_prompt \u$git_branch$hg_branch\$ "
4ce773a @jyurek Added bash config
authored
44 }
45
46 function gemcd {
47 cd `dirname \`gem which $1\``
48 }
49
50 export PROMPT_COMMAND=prompt_command_function
51
ac895ef @jyurek Removed old stuff from bashrc, made brew location more flexible
authored
52 export BREW=/usr/local/bin/brew
4898778 @jyurek Growl should make a sticky, high priority alert when there is a non-z…
authored
53 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
54 export EDITOR=/usr/bin/vim
55
56 export CDPATH=.:~:~/Development
57 alias ...='cd ../..'
58 alias ....='cd ../../..'
59 alias .....='cd ../../../..'
60
e603a90 @jyurek vimmy shell exit
authored
61 alias :q="exit"
62
4ce773a @jyurek Added bash config
authored
63 alias rerc='source ~/.bash_profile'
8b0a5d4 @jyurek Alias mvim to open new files in the same window, but new tab.
authored
64 alias mvim='mvim --servername VIM --remote-tab-silent'
4ce773a @jyurek Added bash config
authored
65
60664a7 @jyurek Removed and put in AWS account switching
authored
66 export AWS_ACCOUNT=jyurek
979c47d @jyurek Add a switching function for EY like the one for AWS
authored
67 function aws_account {
60664a7 @jyurek Removed and put in AWS account switching
authored
68 if [ -f $HOME/.aws/$1 ]; then
69 source $HOME/.aws/$1
70 export AWS_ACCOUNT=$1
71 else
72 echo "No AWS Credentials for $1"
73 fi
74 }
979c47d @jyurek Add a switching function for EY like the one for AWS
authored
75 aws_account $AWS_ACCOUNT
76
77 export EY_ACCOUNT=thoughtbot
78 function ey_account {
79 if [ -f $HOME/.ey/$1 ]; then
80 ln -sf $HOME/.ey/$1 $HOME/.eyrc
81 export EY_ACCOUNT=$1
82 else
83 echo "No EY Credentials for $1"
84 fi
85 }
86 ey_account $EY_ACCOUNT
60664a7 @jyurek Removed and put in AWS account switching
authored
87
ac895ef @jyurek Removed old stuff from bashrc, made brew location more flexible
authored
88 if [ -f `$BREW --prefix`/etc/bash_completion ]; then
89 . `$BREW --prefix`/etc/bash_completion
4ce773a @jyurek Added bash config
authored
90 fi
91
ac895ef @jyurek Removed old stuff from bashrc, made brew location more flexible
authored
92 if [ -f `$BREW --prefix`/etc/bash_completion.d/git-completion.bash ]; then
93 . `$BREW --prefix`/etc/bash_completion.d/git-completion.bash
4ce773a @jyurek Added bash config
authored
94 fi
95
ac895ef @jyurek Removed old stuff from bashrc, made brew location more flexible
authored
96 if [[ -s /Users/$USER/.rvm/scripts/rvm ]] ; then source /Users/$USER/.rvm/scripts/rvm ; fi
4ce773a @jyurek Added bash config
authored
97
Something went wrong with that request. Please try again.