4 if ls --help 2>/dev
/null |
grep -q GNU
; then
5 alias ls='command ls -AF --color=auto'
6 elif isdarwin || isfreebsd
; then
7 alias ls='command ls -AF -G'
10 alias lsbig
='command ls -flh *(.OL[1,10])' # display the biggest files
11 alias lssmall
='command ls -Srl *(.oL[1,10])' # display the smallest files
12 alias lsnew
='command ls -rl *(D.om[1,10])' # display the newest files
13 alias lsold
='command ls -rtlh *(D.om[-11,-1])' # display the oldest files
15 alias mv='command mv -i'
16 alias mmv
='noglob mmv'
17 alias cp='command cp -i'
18 alias wget
='noglob wget'
19 alias cgrep
='grep --color'
21 alias rot13
='tr a-zA-Z n-za-mN-ZA-M'
22 alias scp
='noglob scp'
24 is-callable psql
&& alias psql
='LD_PRELOAD=/lib/libreadline.so.5 psql'
26 alias logout='noglob logout'
28 # want to trace a shell function? ztrace $FUNCTIONNAME and there it goes.
29 alias ztrace
='typeset -f -t'
30 alias zuntrace
='typeset -f +t'
35 # convenient abbreviations
44 alias cd...
='cd ../..'
45 alias cd....
='cd ../../..'
46 alias cd.....
='cd ../../../..'
48 for index
({1.
.9}) alias "$index"="cd -${index}"; unset index
51 alias cpan
='perl -MCPAN -e shell'
55 alias man
='nocorrect noglob man'
56 alias mysql
='nocorrect mysql'
57 alias mkdir
='nocorrect mkdir'
58 alias mv='nocorrect mv'
60 if [ -x /usr
/bin
/recode ]; then
61 alias unix2dos
='recode lat1..ibmpc'
62 alias dos2unix
='recode ibmpc..lat1'
65 # used when you press M-? on a command line
66 alias which-command
='whence -a'
68 # zsh function tracing
69 alias ztrace
='typeset -f -t'
70 alias zuntrace
='typeset -f +t'
72 # Make popd changes permanent without having to wait for logout
73 if zstyle
-T ':ganneff:config' dirstackhandling dirpersist dirstack
; then
74 alias popd="popd;dirpersiststore"
84 #a# create a branch and switch to it
85 alias gbc
='git checkout -b'
86 #a# show details for git branches
87 alias gbl
='git branch -v'
88 #a# show details for git branches incl. remotes
89 alias gbL
='git branch -av'
90 alias gba
='git branch -av'
92 alias gbx
='git branch -d'
93 #a# Move/rename a branch
94 alias gbm
='git branch -m'
97 #a# commit changes in git
98 alias gc
='git commit -v'
99 #a# commit anything changed
100 alias gca
='git commit -v -a'
101 #a# amend last git commit
102 alias gca
='git commit -v --amend'
104 alias gcr
='git revert'
107 alias gcp
='git cherry-pick'
110 alias gap
='git add --patch'
111 alias gau
='git add --update'
113 alias grh
='git reset HEAD'
114 alias grhh
='git reset HEAD --hard'
116 # clone/pull/fetch/push
117 #a# fetch and merge from another repository (pull)
119 #a# fetch and rebase from another repository
120 alias gup
='git pull --rebase'
121 #a# fetch another repository
123 #a# clone another repository
124 alias gcl
='git clone'
127 #a# push everything to origin
128 alias gpoat
='git push origin --all && git push origin --tags'
131 alias gr
='git remote'
132 alias grv
='git remote -v'
133 alias grmv
='git remote rename'
134 alias grrm
='git remote remove'
135 alias grset
='git remote set-url'
136 alias grup
='git remote update'
139 alias gcR
='git reset "HEAD^"'
140 alias gco
='git checkout'
141 alias gcO
='git checkout --patch'
144 alias gst
='git status'
145 alias gss
='git status -s'
148 alias gdc
='git diff --cached'
150 alias gco
='git checkout'
151 alias gcm
='git checkout master'
152 alias gcount
='git shortlog -sn'
153 alias glg
='git log --stat --max-count=5'
154 alias glgg
='git log --graph --max-count=5'
155 alias glgga
='git log --graph --decorate --all'
156 alias gcfl
='git config --list'
157 alias gwc
='git whatchanged -p --abbrev-commit --pretty=medium'
158 alias gf
='git ls-files | grep'
161 # Will cd into the top of the current repository
163 alias grt
='cd $(git rev-parse --show-toplevel || echo ".")'
165 alias gsr
='git svn rebase'
166 alias gsd
='git svn dcommit'
168 # Will return the current branch name
169 # Usage example: git pull origin $(current_branch)
172 ref
=$
(git symbolic-ref HEAD
2> /dev
/null
) || \
173 ref
=$
(git rev-parse
--short HEAD
2> /dev
/null
) ||
return
174 echo ${ref#refs/heads/}
177 current_repository
() {
178 ref
=$
(git symbolic-ref HEAD
2> /dev
/null
) || \
179 ref
=$
(git rev-parse
--short HEAD
2> /dev
/null
) ||
return
180 echo $
(git remote
-v | cut
-d':' -f 2)
183 # these aliases take advantage of the previous function
184 alias ggpull
='git pull origin $(current_branch)'
185 alias ggpush
='git push origin $(current_branch)'
186 alias ggpnp
='git pull origin $(current_branch) && git push origin $(current_branch)'
189 ## global aliases. Handle with care!
191 alias -g LL
="|& less"
192 alias -g WC
='| wc -l'
194 alias -g CD
='| colordiff | less -R'
195 alias -g NE
="2> /dev/null"