Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 163 lines (131 sloc) 4.123 kb
5f7b6401 »
2013-01-12 Modify prompt. Drop rvm for chruby.
1 function timer_start {
2 timer=${timer:-$SECONDS}
3 }
4
5 function timer_stop {
6 timer_show=$(($SECONDS - $timer))
7 unset timer
8 }
9
10 trap 'timer_start' DEBUG
11
4ce773af »
2010-07-13 Added bash config
12 function parse_git_dirty {
13 [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo '✏ '
14 }
15
16 function parse_git_branch {
13916526 »
2012-11-03 Various and sundry.
17 git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
4ce773af »
2010-07-13 Added bash config
18 }
19
a0fdae7c »
2010-09-17 Added hgrc
20 function parse_hg_branch {
21 hg branch 2>/dev/null
22 }
23
4ce773af »
2010-07-13 Added bash config
24 function latest_command {
25 history | tail -n 1 | sed 's/[0-9 ]*\(.*\)/\1/'
26 }
27
8d58402f »
2013-02-19 Various changes
28 function is_frontmost {
5f7b6401 »
2013-01-12 Modify prompt. Drop rvm for chruby.
29 iterm_is_frontmost_application=$(osascript -e 'tell application "iTerm" to get frontmost')
30 frontmost_in_iterm=$(osascript -e 'tell application "iTerm" to tell the current terminal to tell the current session to get id')
31 this_terminal=`tty`
32
8d58402f »
2013-02-19 Various changes
33 frontmost="true"
5f7b6401 »
2013-01-12 Modify prompt. Drop rvm for chruby.
34 if [[ $iterm_is_frontmost_application == "true" ]]; then
35 if [[ $frontmost_in_iterm == $this_terminal ]]; then
8d58402f »
2013-02-19 Various changes
36 frontmost=
5f7b6401 »
2013-01-12 Modify prompt. Drop rvm for chruby.
37 fi
38 fi
39 }
40
4ce773af »
2010-07-13 Added bash config
41 function growl_latest_command {
48987785 »
2010-08-16 Growl should make a sticky, high priority alert when there is a non-z…
42 priority="Normal"
5f7b6401 »
2013-01-12 Modify prompt. Drop rvm for chruby.
43 if [[ $1 != 0 ]]; then
73b2eda1 »
2010-08-23 Different Growl notifications for exitcode == 0 and != 0
44 priority="Emergency"
48987785 »
2010-08-16 Growl should make a sticky, high priority alert when there is a non-z…
45 fi
5f7b6401 »
2013-01-12 Modify prompt. Drop rvm for chruby.
46
8d58402f »
2013-02-19 Various changes
47 latest_command | growlnotify -p $priority -n "Command Prompt $priority" `pwd` 1>/dev/null 2>&1
4ce773af »
2010-07-13 Added bash config
48 }
49
50 function prompt_command_function
51 {
48987785 »
2010-08-16 Growl should make a sticky, high priority alert when there is a non-z…
52 last_result=$?
5f7b6401 »
2013-01-12 Modify prompt. Drop rvm for chruby.
53 timer_stop
54 # growl_latest_command $last_result
4ce773af »
2010-07-13 Added bash config
55
48987785 »
2010-08-16 Growl should make a sticky, high priority alert when there is a non-z…
56 last_result="\[\e[33m\]$last_result\[\e[0m\]"
57 titlebar_last_command="\[\e]2;$(latest_command)\a\]"
4ce773af »
2010-07-13 Added bash config
58
59 git_branch=$(parse_git_branch)
a0fdae7c »
2010-09-17 Added hgrc
60 hg_branch=$(parse_hg_branch)
4ce773af »
2010-07-13 Added bash config
61 git_dirty= #$(parse_git_dirty)
a0fdae7c »
2010-09-17 Added hgrc
62 hg_dirty=
4ce773af »
2010-07-13 Added bash config
63
64 git_dirty=${git_dirty:+" \[\e[31m\]$git_dirty\[\e[0m\]"}
65 git_branch=${git_branch:+" (\[\e[35m\]${git_branch}\[\e[0m\]${git_dirty})"}
a0fdae7c »
2010-09-17 Added hgrc
66 hg_branch=${hg_branch:+" (\[\e[36m\]${hg_branch}\[\e[0m\]${hg_dirty})"}
4ce773af »
2010-07-13 Added bash config
67
5f7b6401 »
2013-01-12 Modify prompt. Drop rvm for chruby.
68 current_ruby=$(basename ${RUBY_ROOT:-none})
69
70 PS1="$titlebar_last_command$last_result [\[\e[32m\]${timer_show}s\[\e[0m\]] \h:\[\e[32m\]\w\[\e[0m\] \e[33m$current_ruby\e[0m \u$git_branch$hg_branch\$ "
4ce773af »
2010-07-13 Added bash config
71 }
72
73 function gemcd {
74 cd `dirname \`gem which $1\``
75 }
76
13916526 »
2012-11-03 Various and sundry.
77 function ghistory
78 {
79 git grep $1 $(git rev-list --all)
80 }
81
4ce773af »
2010-07-13 Added bash config
82 export PROMPT_COMMAND=prompt_command_function
83
ac895ef2 »
2010-07-27 Removed old stuff from bashrc, made brew location more flexible
84 export BREW=/usr/local/bin/brew
469bc5b0 »
2011-06-29 homebrew env tweaks
85 export BREW_HOME=`$BREW --prefix`
8d58402f »
2013-02-19 Various changes
86 export PATH=./bin:$BREW_HOME/bin:$BREW_HOME/sbin:$HOME:$PATH:$HOME/.dotfiles/bin:$HOME/bin:/usr/local/share/python
4ce773af »
2010-07-13 Added bash config
87 export EDITOR=/usr/bin/vim
88
89 export CDPATH=.:~:~/Development
e603a903 »
2010-12-14 vimmy shell exit
90 alias :q="exit"
8d58402f »
2013-02-19 Various changes
91 alias :e="$EDITOR"
4ce773af »
2010-07-13 Added bash config
92 alias rerc='source ~/.bash_profile'
8b0a5d42 »
2010-08-18 Alias mvim to open new files in the same window, but new tab.
93 alias mvim='mvim --servername VIM --remote-tab-silent'
9c0b53af »
2011-06-29 Aliases and dark solarized colors
94 alias be='bundle exec'
13916526 »
2012-11-03 Various and sundry.
95 alias remigrate='rake db:migrate && rake db:migrate:redo && rake db:schema:dump db:test:prepare'
96 alias dnsip='dig myip.opendns.com @resolver1.opendns.com +short'
8d58402f »
2013-02-19 Various changes
97 alias psg='ps aux | ag'
13916526 »
2012-11-03 Various and sundry.
98
9c0b53af »
2011-06-29 Aliases and dark solarized colors
99 ssh-agent
100 ssh-add
4ce773af »
2010-07-13 Added bash config
101
60664a7a »
2010-08-08 Removed and put in AWS account switching
102 export AWS_ACCOUNT=jyurek
979c47dc »
2010-08-23 Add a switching function for EY like the one for AWS
103 function aws_account {
60664a7a »
2010-08-08 Removed and put in AWS account switching
104 if [ -f $HOME/.aws/$1 ]; then
105 source $HOME/.aws/$1
106 export AWS_ACCOUNT=$1
107 else
108 echo "No AWS Credentials for $1"
109 fi
110 }
979c47dc »
2010-08-23 Add a switching function for EY like the one for AWS
111 aws_account $AWS_ACCOUNT
112
113 export EY_ACCOUNT=thoughtbot
114 function ey_account {
115 if [ -f $HOME/.ey/$1 ]; then
116 ln -sf $HOME/.ey/$1 $HOME/.eyrc
117 export EY_ACCOUNT=$1
118 else
119 echo "No EY Credentials for $1"
120 fi
121 }
122 ey_account $EY_ACCOUNT
60664a7a »
2010-08-08 Removed and put in AWS account switching
123
c4e16eff »
2013-01-12 Java variables and ec2 switching
124 function ec2env {
125 env=$1
126 export EC2_KEYS_HOME=~/.ec2${env:+"_${env}"}
127 . $EC2_KEYS_HOME/profile
128 }
129 ec2env backupifydev
130
131 export JAVA_HOME="$(/usr/libexec/java_home)"
8d58402f »
2013-02-19 Various changes
132 # export EC2_PRIVATE_KEY="$(/bin/ls "$HOME"/.ec2/pk-*.pem | /usr/bin/head -1)"
133 # export EC2_CERT="$(/bin/ls "$HOME"/.ec2/cert-*.pem | /usr/bin/head -1)"
c4e16eff »
2013-01-12 Java variables and ec2 switching
134 export EC2_AMITOOL_HOME="/usr/local/Library/LinkedKegs/ec2-ami-tools/jars"
135 export EC2_HOME="/usr/local/Library/LinkedKegs/ec2-api-tools/jars"
136
137 export CC=/usr/local/bin/gcc-4.2
b486eecf »
2011-03-15 Some tweaks
138
469bc5b0 »
2011-06-29 homebrew env tweaks
139 if [ -f $BREW_HOME/etc/bash_completion ]; then
140 . $BREW_HOME/etc/bash_completion
4ce773af »
2010-07-13 Added bash config
141 fi
142
469bc5b0 »
2011-06-29 homebrew env tweaks
143 if [ -f $BREW_HOME/etc/bash_completion.d/git-completion.bash ]; then
144 . $BREW_HOME/etc/bash_completion.d/git-completion.bash
4ce773af »
2010-07-13 Added bash config
145 fi
146
13916526 »
2012-11-03 Various and sundry.
147 function g {
148 if [[ $# > 0 ]]; then
149 git $@
150 else
151 git st
152 fi
153 }
154
8d58402f »
2013-02-19 Various changes
155 # # Use chruby instead of rvm
5f7b6401 »
2013-01-12 Modify prompt. Drop rvm for chruby.
156 export RBXOPT=-X19
157 . /usr/local/opt/chruby/share/chruby/chruby.sh
158 export RUBIES=(/usr/local/ruby/*)
159 chruby 1.9.3
8d58402f »
2013-02-19 Various changes
160
161 # Use rbenv instead of chruby
162 # eval "$(rbenv init -)"
163 # export PATH=$HOME/.rbenv/bin:$PATH
Something went wrong with that request. Please try again.