Fix syntax error
[abe:zshrc.git] / zsh.d / 50-alias
1 # -*- sh -*-
2 ################
3 # abe's .alias #
4 ################
5
6 # Former \!* using tcsh aliases have been converted to functions
7
8 ### DEBUG ###
9 #set -x
10
11 # Aliases starting with special characters
12 #-() { cd - }
13 -() { popd "$@" }
14 +() { pushd "$@" }
15 -1 -2 -3 -4 -5 -6 -7 -8 -9 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9() { pushd $0 }
16
17 alias   cd..='cd ..'
18 alias   ...='cd ../..'
19 alias   ....='cd ../../..'
20
21 # One character aliases
22 alias   c=cat
23 #unfunction d
24 alias   d='dirs -v'
25 alias   g='fgrep --color=auto'
26 alias   l=less
27 alias   m=mutt
28 alias   o='$PAGER'
29 alias   q=exit
30 alias   t=touch
31
32 if [ -r /usr/share/autojump/autojump.sh ]; then
33     alias j > /dev/null && unalias j
34     .  /usr/share/autojump/autojump.sh
35 fi
36
37 # Two character aliases
38 alias    eg='egrep --color=auto'
39 function ff() { find . -name "$@" }
40 alias    gr='grep --color=auto'
41 alias    qu='quota -v'
42 alias    tn=telnet
43 alias    vf=cd
44 alias    xs=cd
45 if whence xd > /dev/null; then
46     function xd() { cd $(command xd "$@") }
47 fi
48 function df() { command df -TP "$@" | column -t }
49
50 alias   mx="nslookup -sil -q=mx"
51 alias   ns="nslookup -sil -q=ns"
52
53 alias   ls='ls -F --color=auto'
54 alias   la='ls -AF'
55 alias   ll='ls -AlF'
56
57 # In average two and a half character aliases ;-)
58 if whence wcd > /dev/null; then
59     alias wd=wcd
60     function wcd {
61         wcd.exec "$@"
62         . $HOME/bin/wcd.go
63     }
64 fi
65
66 # Three character aliases
67 alias   acs='apt-cache show'
68 alias   acp='apt-cache policy'
69 alias   ac/='apt-cache search'
70 alias   af/='apt-file search'
71 alias   afs='apt-file search'
72 alias   afl='apt-file list'
73 alias   afu='apt-file update'
74 alias   ag/='aptitude search'
75 alias   agi='aptitude install'
76 alias   ag+='aptitude install'
77 alias   ag-='aptitude remove'
78 alias   agr='aptitude remove'
79 alias   ag_='aptitude purge'
80 alias   agp='aptitude purge'
81 alias   agu='aptitude update'
82 alias   agh='aptitude hold'
83 alias   agc='apt-get clean'
84 alias   agw='aptitude why'
85 alias   'a-u'='aptitude -u'
86 alias   asv='apt-show-versions'
87 function ffi() { find . -iname "$@" }
88 function lpr() { command lpr "$@"; lpq }
89 alias   cd-='cd -'
90 alias   cls=clear # Yeah, that's from DOS
91 alias   ino='inotail -f'
92 alias   nsl=nslookup
93 alias   ooo=openoffice
94 alias   OOo=openoffice
95
96 function asc() {
97     # Set the title to something more obvious, e.g. the expanded
98     # alias, eh, function
99     print -Pn "\e]0;%n@%m: autossh -t $* 'screen -RdU'\a";
100     autossh -x -a -t "$@" 'screen -RdU'
101 }
102 compdef asc=ssh
103
104 # Four character aliases
105 function assh() {
106     # Set the title to something more obvious, e.g. the expanded
107     # alias, eh, function
108     print -Pn "\e]0;%n@%m: autossh $*\a";
109     autossh "$@"
110 }
111 compdef assh=ssh
112
113 fucntion http() { telnet $1 80 }
114 alias   root='ssh root@localhost'
115 alias   acss='apt-cache showsrc'
116 alias   agsu='aptitude safe-upgrade'
117 alias   agdu='aptitude full-upgrade'
118 alias   agma='aptitude markauto'
119 alias   agri='aptitude reinstall'
120 alias   aguh='aptitude unhold'
121 alias   agbd='aptitude build-dep'
122 alias   agwn='aptitude why-not'
123
124 # Five character aliases
125 alias    deurl='$HOME/bin/url_decode.pl'
126 function perlv()        { perl -le "use $1; print "'$'"$1"'::VERSION;' }
127 alias    acsrc='apt-cache showsrc'
128 alias    aguma='aptitude unmarkauto'
129 function mount() {
130     if [ $# -eq 0 ]; then
131         command mount | column -t
132     else
133         command mount "$@"
134     fi
135 }
136
137 # noglob aliasses
138 alias   mmv='noglob mmv'
139 alias   wget='noglob wget'
140 alias   find='noglob find'
141 alias   clive='noglob clive'
142 alias   clivescan='noglob clivescan'
143 alias   translate='noglob translate'
144 alias   links='noglob links'
145 alias   links2='noglob links2'
146 alias   xlinks2='noglob xlinks2'
147 alias   lynx='noglob lynx'
148
149 # Compose key errors
150 alias   ßh=ssh
151
152 # ls sorting (Idea from zsh book)
153 alias lsbig=ls -lhSr
154 alias lssmall=ls -lhS
155 alias lsnew=ls -lhtr
156 alias lsold=ls -lht
157
158 # grep with color by default
159 alias   grep='grep --color=auto'
160 alias   fgrep='fgrep --color=auto'
161 alias   egrep='egrep --color=auto'
162
163 # OpenSSL
164 for i in sha512 sha256 sha1 md5; do
165         ssl-cert-$i() { openssl x509 -noout -fingerprint -$i -in $1 }
166 done
167
168 ssl-cert-fingerprints() {
169         for i in sha512 sha256 sha1 md5; do
170                 ssl-cert-$i $1
171         done
172 }
173
174 ssl-cert-info() {
175         openssl x509 -noout -text -in $1
176         ssl-cert-fingerprints $1
177 }
178
179 ### Set ###
180 alias   setvi='export EDITOR=vi VISUAL=vi'
181 alias   setvim='export EDITOR=vim VISUAL=vim'
182 alias   setzile='export EDITOR=zile VISUAL=zile'
183 alias   setemacs='export EDITOR="emacsclient -a emacs" VISUAL="emacsclient -a emacs"'
184 #alias   edit='$EDITOR'
185 alias   vt100='export TERM=vt100'
186
187 ### Gags ###
188 #alias  y='echo "Hallo, sind wir noch wach, oder sind wir wieder auf die Y-Taste gefallen? ;-)"'
189
190 # Teppfihler
191 alias   amek=make
192 alias   nls=nsl
193 #alias  sl=ls
194 alias   les=less
195 alias   lesss=less
196
197 ### Laden weiterer Aliasse
198
199 #alias  xal='source ~/.Xalias'
200
201 #if ( -f $home/.alias.mtools ) then
202 #  source $home/.alias.mtools
203 #endif
204 #if ( -f $home/.alias.wapua ) then
205 #  source $home/.alias.wapua
206 #endif
207
208
209 # Idea from Sven's zsh Book (and yeah I overwrite the previous reload
210 # function which reloaded the zshrc.
211 start stop restart reload force-reload() {
212     sudo invoke-rc.d $1 $0
213 }
214
215 # From http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=299228
216 apt-rbdepends () {
217     grep-dctrl -F Build-Depends "$1" -s Package /var/lib/apt/lists/*_Sources \
218         | sort -u
219 }