forked from mislav/dotfiles
/
bash_aliases
141 lines (124 loc) · 3.2 KB
/
bash_aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Some useful aliases
# vi:filetype=sh:
alias aliases='vim ~/.bash_aliases && source ~/.bash_aliases'
# Function which adds an alias to the current shell and to
# the ~/.bash_aliases file.
add-alias ()
{
local name=$1 value="$2"
echo "alias $name='$value'" >> ~/.bash_aliases
eval "alias $name='$value'"
alias $name
}
#######
# git #
#######
alias gl='git pull'
alias gp='git push'
alias gd='git diff'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch -v'
function gco {
if [ -z "$1" ]; then
git checkout master
else
git checkout $1
fi
}
function st {
if [ -d ".svn" ]; then
svn status
else
git status
fi
}
#######
# SVN #
#######
alias sup='svn up' # trust me 3 chars makes a different
# alias sstu='svn st -u' # remote repository changes
# alias scom='svn commit' # commit
alias svnclear='find . -name .svn -print0 | xargs -0 rm -rf' # removes all .svn folders from directory recursively
alias svnaddall='svn status | grep "^\?" | awk "{print \$2}" | xargs svn add' # adds all unadded files
########
# RUBY #
########
# use readline, completion and require rubygems by default for irb
alias irb='irb --simple-prompt -r irb/completion -rubygems'
# really awesome function, use: cdgem <gem name>, cd's into your gems directory
# and opens gem that best matches the gem name provided
function cdgem {
cd `gem env gemdir`/gems
cd `ls | grep $1 | sort | tail -1`
}
function gemdoc {
GEMDIR=`gem env gemdir`/doc
open $GEMDIR/`ls $GEMDIR | grep $1 | sort | tail -1`/rdoc/index.html
}
function mategem {
GEMDIR=`gem env gemdir`/gems
mate $GEMDIR/`ls $GEMDIR | grep $1 | sort | tail -1`
}
alias qri='qri -w 98'
alias fri='fri -w 98'
#########
# RAILS #
#########
alias sc='script/console'
alias ss='script/server' # start up the beast; use "ss -d" to detach
# stop daemonized Rails server
function sst() {
if [ -f tmp/pids/mongrel.pid ]; then
echo "Stopping Mongrel ..."
kill `cat tmp/pids/mongrel.pid`
elif [ -f tmp/pids/server.pid ]; then
echo "Stopping server ..."
kill `cat tmp/pids/server.pid`
fi
}
# restart Rails application
function sr() {
if [ -f tmp/pids/mongrel.pid ]; then
echo "Restarting Mongrel ..."
kill -USR2 `cat tmp/pids/mongrel.pid`
elif [ -f tmp/pids/server.pid ]; then
echo "Restarting server ..."
kill -USR2 `cat tmp/pids/server.pid`
else
echo "Restarting Passenger instances ..."
touch tmp/restart.txt
fi
}
# see http://railstips.org/2007/5/31/even-edgier-than-edge-rails
function edgie() {
ruby ~/.coral/rails/rails/railties/bin/rails $1 && cd $1 && ln -s ~/.coral/rails/rails vendor/rails
}
########
# misc #
########
alias texclean='rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky'
alias clean='echo -n "Really clean this directory?";
read yorn;
if test "$yorn" = "y"; then
rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp core a.out;
echo "Cleaned.";
else
echo "Not cleaned.";
fi'
alias h='history'
alias j="jobs -l"
alias l="ls -lah"
alias ll="ls -l"
alias la='ls -A'
# alias pu="pushd"
# alias po="popd"
#
# Csh compatability:
#
alias unsetenv=unset
function setenv () {
export $1="$2"
}
########
alias flashlog='tail -f ~/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt'