initial
[zsh.git] / .zsh / 35_Aliases.zsh
1 # -*- mode: sh;-*-
2
3 # default switches
4 alias ls='command ls -AF --color=auto'
5 alias lsbig='command ls -flh *(.OL[1,10])' # display the biggest files
6 alias lssmall='command ls -Srl *(.oL[1,10])' # display the smallest files
7 alias lsnew='command ls -rl *(D.om[1,10])' # display the newest files
8 alias lsold='command ls -rtlh *(D.om[-11,-1])' # display the oldest files
9
10 alias mv='command mv -i'
11 alias mmv='noglob mmv'
12 alias cp='command cp -i'
13 alias wget='noglob wget'
14 alias cgrep='grep --color'
15 alias git='LANG=C git'
16 alias rot13='tr a-zA-Z n-za-mN-ZA-M'
17
18 alias psql='LANG=C LD_PRELOAD=/lib/libreadline.so.5 psql'
19 alias tmux='TMPDIR=/tmp tmux'
20
21 alias logout='noglob logout'
22
23 # convenient abbreviations
24 alias c=clear
25
26 alias d='dirs -v'
27
28 alias cd/='cd /'
29 alias ..='cd ..'
30 alias ...='cd ../..'
31 alias cd..='cd ..'
32 alias cd...='cd ../..'
33 alias cd....='cd ../../..'
34 alias cd.....='cd ../../../..'
35 alias -- -='cd -'
36 alias 1='cd -'
37 alias 2='cd -2'
38 alias 3='cd -3'
39 alias 4='cd -4'
40 alias 5='cd -5'
41 alias 6='cd -6'
42 alias 7='cd -7'
43 alias 8='cd -8'
44 alias 9='cd -9'
45
46
47
48 alias mc='mc -d -U'
49 alias showpkg='apt-cache showpkg'
50 alias acs='apt-cache search'
51 alias acw='apt-cache show'
52 alias agi='LANG=C sudo aptitude install'
53 alias agr='LANG=C sudo aptitude remove'
54 alias agp='LANG=C sudo aptitude purge'
55 alias dclean='LANG=C LC_ALL=C fakeroot debian/rules clean'
56 alias cpan='perl -MCPAN -e shell'
57
58 # No spellchecks here
59 alias man='LANG=C nocorrect noglob man'
60 alias mysql='nocorrect mysql'
61 alias mkdir='nocorrect mkdir'
62 alias mv='nocorrect mv'
63
64 #global aliases. Handle with care!
65 alias -g LS='| less'
66 alias -g WC='| wc -l'
67 alias -g SO='| sort'
68 alias -g CD='| colordiff | less -R'
69
70 if [ -x /usr/bin/recode ]; then
71 alias unix2dos='recode lat1..ibmpc'
72 alias dos2unix='recode ibmpc..lat1'
73 fi
74
75 # used when you press M-? on a command line
76 alias which-command='whence -a'
77
78 # zsh function tracing
79 alias ztrace='typeset -f -t'
80 alias zuntrace='typeset -f +t'
81
82 alias gitolite_spi='ssh git@git.spi-inc.org'
83
84 # Make popd changes permanent without having to wait for logout
85 alias popd="popd;dirpersiststore"
86
87 # git related
88 # Aliases
89 alias g='git'
90 alias gst='git status'
91 alias gl='git pull'
92 alias gup='git pull --rebase'
93 alias gp='git push'
94 alias gd='git diff'
95 alias gc='git commit -v'
96 alias gca='git commit -v -a'
97 alias gco='git checkout'
98 alias gcm='git checkout master'
99 alias gr='git remote'
100 alias grv='git remote -v'
101 alias grmv='git remote rename'
102 alias grrm='git remote remove'
103 alias grset='git remote set-url'
104 alias grup='git remote update'
105 alias gb='git branch'
106 alias gba='git branch -a'
107 alias gcount='git shortlog -sn'
108 alias gcl='git config --list'
109 alias gcp='git cherry-pick'
110 alias glg='git log --stat --max-count=5'
111 alias glgg='git log --graph --max-count=5'
112 alias glgga='git log --graph --decorate --all'
113 alias gss='git status -s'
114 alias ga='git add'
115 alias gm='git merge'
116 alias grh='git reset HEAD'
117 alias grhh='git reset HEAD --hard'
118 alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
119 alias gf='git ls-files | grep'
120 alias gpoat='git push origin --all && git push origin --tags'
121
122 # Will cd into the top of the current repository
123 # or submodule.
124 alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
125
126 alias gsr='git svn rebase'
127 alias gsd='git svn dcommit'
128
129 # Will return the current branch name
130 # Usage example: git pull origin $(current_branch)
131 #
132 current_branch() {
133 ref=$(git symbolic-ref HEAD 2> /dev/null) || \
134 ref=$(git rev-parse --short HEAD 2> /dev/null) || return
135 echo ${ref#refs/heads/}
136 }
137
138 current_repository() {
139 ref=$(git symbolic-ref HEAD 2> /dev/null) || \
140 ref=$(git rev-parse --short HEAD 2> /dev/null) || return
141 echo $(git remote -v | cut -d':' -f 2)
142 }
143
144 # these aliases take advantage of the previous function
145 alias ggpull='git pull origin $(current_branch)'
146 alias ggpush='git push origin $(current_branch)'
147 alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'