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 if zstyle
-T ':ganneff:config' safemvcp false
; then
16 alias mv='nocorrect command mv'
17 alias cp='nocorrect command cp'
19 alias mv='nocorrect command mv -i'
20 alias cp='nocorrect command cp -i'
22 # Number of aliases for commands we don't want to do globbing usually
23 alias wget
='noglob wget'
24 alias scp
='noglob scp'
26 # No spellchecks for these
27 alias man
='nocorrect noglob man'
28 alias mysql
='nocorrect mysql'
29 alias mkdir
='nocorrect mkdir'
31 # want to trace a shell function? ztrace $FUNCTIONNAME and there it goes.
32 #a# trace a shell function
33 alias ztrace
='typeset -f -t'
34 #a# no longer trace a shell function
35 alias zuntrace
='typeset -f +t'
37 # SSHs multisession can be controlled by giving commands to -O.
38 # Valid ones are check, forward, cancel, exit and stop, see man ssh_config
40 alias sshx
="ssh -O exit"
41 alias sshc
="ssh -O check"
42 alias sshf
="ssh -O forward"
43 alias sshfc
="ssh -O cancel"
44 alias sshs
="ssh -O stop"
49 # convenient abbreviations
53 # Various little cd helpers
57 alias ....
='cd ../../..'
58 alias .....
='cd ../../../..'
60 alias cd...
='cd ../..'
61 alias cd....
='cd ../../..'
62 alias cd.....
='cd ../../../..'
64 for index
({1.
.9}) alias "$index"="cd -${index}"; unset index
67 alias cgrep
='grep --color'
68 alias rot13
='tr a-zA-Z n-za-mN-ZA-M'
69 is-command mc
&& alias mc
='mc -d -U'
70 alias cpan
='perl -MCPAN -e shell'
73 if [ -x /usr
/bin
/recode ]; then
74 alias unix2dos
='recode lat1..ibmpc'
75 alias dos2unix
='recode ibmpc..lat1'
78 # used when you press M-? on a command line
79 alias which-command
='whence -a'
81 # Make popd changes permanent without having to wait for logout
82 if zstyle
-T ':ganneff:config' dirstackhandling dirpersist dirstack
; then
83 alias popd="popd;dirpersiststore"
93 #a# create a branch and switch to it
94 alias gbc
='git checkout -b'
95 #a# show details for git branches
96 alias gbl
='git branch -v'
97 #a# show details for git branches incl. remotes
98 alias gba
='git branch -av'
100 alias gbd
='git branch -d'
101 #a# Move/rename a branch
102 alias gbm
='git branch -m'
105 #a# add changes to index
107 #a# add changes, interactively choose hunks to add
108 alias gap
='git add --patch'
109 #a# add changes, only files already in the indey
110 alias gau
='git add --update'
114 #a# commit changes in git
115 alias gc
='git commit -v'
116 #a# amend last git commit
117 alias gca
='git commit -v --amend'
118 #a# fixup last git commit
119 alias gcf
='git commit --fixup @'
120 #a# squash last git commit
121 alias gcs
='git commit --squash @'
122 #a# fixup last commit and push it directly
123 alias gcfp
='git commit --fixup @ && git push origin'
124 #a# squash last git commit and push it directly
125 alias gcsp
='git commit --squash @ && git push origin'
130 #a# push everything to origin
131 alias gpoat
='git push origin --all && git push origin --tags'
134 #a# fetch and merge from another repository (pull)
136 #a# fetch and rebase from another repository
137 alias gup
='git pull --rebase'
138 #a# fetch and merge from another repository (pull), cleaning up
139 #remote-tracking references that no longer exist on the remote
140 alias glp
='git pull --prune'
141 #a# fetch another repository
143 #a# clone another repository
144 alias gcl
='git clone'
147 #a# checkout a branch
148 alias gco
='git checkout'
149 #a# switch to the master branch
150 alias gcm
='git checkout master'
155 #a# merge, but don't commit
156 alias gmn
='git merge --no-ff --no-commit'
159 #a# Show changes in the working tree
161 #a# Show changes in the index
162 alias gdc
='git diff --cached'
163 #a# Show logs with differences each commit introduces
164 alias gwc
='git whatchanged -p --abbrev-commit --pretty=medium'
170 #a# Show 10 latest commit logs
171 alias glg
='git log --stat --max-count=10'
172 #a# Show 10 latest commit logs with a text-based graph
173 alias glgg
='git log --graph --max-count=10'
174 #a# Show all commits with a text-based graph
175 alias glgga
='git log --graph --decorate --all'
179 alias gcr
='git revert'
181 alias gcp
='git cherry-pick'
184 alias grh
='git reset HEAD'
185 #a# reset HEAD discarding all changes to tracked files
186 alias grhh
='git reset HEAD --hard'
188 #a# show working tree status
189 alias gst
='git status'
197 #a# list commit count summary
198 alias gcount
='git shortlog -sn'
202 alias gr
='git rebase'
203 #a# rebase interactive on master
204 alias gri
='git rebase -i master'
206 alias grc
='git rebase --continue'
208 alias gra
='git rebase --abort'
213 alias gre
='git remote'
214 #a# list remotes including their fetch/push details
215 alias grev
='git remote -v'
216 alias gremv
='git remote rename'
217 alias grerm
='git remote remove'
219 # Will cd into the top of the current repository
221 alias grt
='cd $(git rev-parse --show-toplevel || echo ".")'
223 ## global aliases. Handle with care!
225 alias -g LL
="|& less"
226 alias -g WC
='| wc -l'
228 alias -g CD
='| colordiff | less -R'
229 alias -g NE
="2> /dev/null"