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'
20 alias git
='LANG=C git'
21 alias rot13
='tr a-zA-Z n-za-mN-ZA-M'
23 alias psql
='LANG=C LD_PRELOAD=/lib/libreadline.so.5 psql'
25 alias logout='noglob logout'
27 # want to trace a shell function? ztrace $FUNCTIONNAME and there it goes.
28 alias ztrace
='typeset -f -t'
29 alias zuntrace
='typeset -f +t'
34 # convenient abbreviations
43 alias cd...
='cd ../..'
44 alias cd....
='cd ../../..'
45 alias cd.....
='cd ../../../..'
47 for index
({1.
.9}) alias "$index"="cd -${index}"; unset index
50 alias cpan
='perl -MCPAN -e shell'
54 alias man
='LANG=C nocorrect noglob man'
55 alias mysql
='nocorrect mysql'
56 alias mkdir
='nocorrect mkdir'
57 alias mv='nocorrect mv'
59 #global aliases. Handle with care!
63 alias -g CD
='| colordiff | less -R'
65 if [ -x /usr
/bin
/recode ]; then
66 alias unix2dos
='recode lat1..ibmpc'
67 alias dos2unix
='recode ibmpc..lat1'
70 # used when you press M-? on a command line
71 alias which-command
='whence -a'
73 # zsh function tracing
74 alias ztrace
='typeset -f -t'
75 alias zuntrace
='typeset -f +t'
77 alias gitolite_spi
='ssh git@git.spi-inc.org'
79 # Make popd changes permanent without having to wait for logout
80 alias popd="popd;dirpersiststore"
85 alias gst
='git status'
87 alias gup
='git pull --rebase'
90 alias gc
='git commit -v'
91 alias gca
='git commit -v -a'
92 alias gco
='git checkout'
93 alias gcm
='git checkout master'
95 alias grv
='git remote -v'
96 alias grmv
='git remote rename'
97 alias grrm
='git remote remove'
98 alias grset
='git remote set-url'
99 alias grup
='git remote update'
100 alias gb
='git branch'
101 alias gba
='git branch -a'
102 alias gcount
='git shortlog -sn'
103 alias gcl
='git config --list'
104 alias gcp
='git cherry-pick'
105 alias glg
='git log --stat --max-count=5'
106 alias glgg
='git log --graph --max-count=5'
107 alias glgga
='git log --graph --decorate --all'
108 alias gss
='git status -s'
111 alias grh
='git reset HEAD'
112 alias grhh
='git reset HEAD --hard'
113 alias gwc
='git whatchanged -p --abbrev-commit --pretty=medium'
114 alias gf
='git ls-files | grep'
115 alias gpoat
='git push origin --all && git push origin --tags'
117 # Will cd into the top of the current repository
119 alias grt
='cd $(git rev-parse --show-toplevel || echo ".")'
121 alias gsr
='git svn rebase'
122 alias gsd
='git svn dcommit'
124 # Will return the current branch name
125 # Usage example: git pull origin $(current_branch)
128 ref
=$
(git symbolic-ref HEAD
2> /dev
/null
) || \
129 ref
=$
(git rev-parse
--short HEAD
2> /dev
/null
) ||
return
130 echo ${ref#refs/heads/}
133 current_repository
() {
134 ref
=$
(git symbolic-ref HEAD
2> /dev
/null
) || \
135 ref
=$
(git rev-parse
--short HEAD
2> /dev
/null
) ||
return
136 echo $
(git remote
-v | cut
-d':' -f 2)
139 # these aliases take advantage of the previous function
140 alias ggpull
='git pull origin $(current_branch)'
141 alias ggpush
='git push origin $(current_branch)'
142 alias ggpnp
='git pull origin $(current_branch) && git push origin $(current_branch)'