public
Description: bash, git, vim, irb, rails, sake
Clone URL: git://github.com/mislav/dotfiles.git
mislav (author)
Tue May 13 06:16:04 -0700 2008
commit  9ab7069758c27b7aa6821c6833c9282bc2de630e
tree    cbc0e506f56cfab4bc59d42536537f33d3ef7bd6
parent  098ae3cf4b975076e5cd49df9d6434759e79b61b
dotfiles / bash_aliases
100644 114 lines (99 sloc) 2.639 kb
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
# 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
  gnome-open $GEMDIR/`ls $GEMDIR | grep $1 | sort | tail -1`/rdoc/index.html
}
 
alias qri='qri -w 106'
alias fri='fri -w 106'
 
#########
# RAILS #
#########
alias sc='script/console'
alias ss='script/server' # start up the beast; use "ss -d" to detach
alias sr='kill -USR2 `cat tmp/pids/mongrel.pid`' # restart daemonized Mongrel
alias sst='kill `cat tmp/pids/mongrel.pid`' # stop daemonized Mongrel
alias a='autotest -rails'
 
# see http://railstips.org/2007/5/31/even-edgier-than-edge-rails
function edgie() {
  ruby ~/projects/rails/rails/railties/bin/rails $1 && cd $1 && ln -s ~/projects/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"
}
 
########