]> git.madduck.net Git - etc/zsh.git/blob - .zsh/zshrc/30_aliases

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

add trace function
[etc/zsh.git] / .zsh / zshrc / 30_aliases
1 # zshrc/30_aliases
2 #
3 # Defines command shortcuts
4 #
5 # Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
6 # Released under the terms of the Artistic Licence 2.0
7 #
8 # Source repository: git://git.madduck.net/etc/zsh.git
9 #
10
11 function trace() { eval "set -x; $@" }
12
13 alias mv='nocorrect mv'
14 alias cp='nocorrect cp'
15 alias ln='nocorrect ln'
16 alias mkdir='nocorrect mkdir'
17 alias rm='nocorrect rm'
18
19 alias find='noglob find'
20 alias w3m='noglob w3m -no-mouse'
21 alias links='noglob links'
22 alias wb='noglob www-browser'
23 alias wget='noglob wget'
24 alias curl='noglob curl'
25 alias apt-cache='noglob apt-cache'
26 alias locate='noglob locate'
27
28 local _USER_AGENT="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.14) Gecko/20080404 Iceweasel/2.0.0.14 (Debian-2.0.0.14-2)"
29 alias swget="noglob wget --user-agent='$USER_AGENT'"
30
31 typeset -a _ls_opts; _ls_opts=(-bC --color=auto)
32 command ls --group-directories-first >/dev/null 2>&1 \
33   && _ls_opts+=--group-directories-first
34 # I prefer POSIX collation for ls
35 alias ls="LC_COLLATE=POSIX ls $_ls_opts"
36
37 alias l='ls --time-style=+%Y%m%d.%H%M -gG'
38 alias ll='ls -l'
39 alias la='ls -a'
40 alias lla='ls -la'
41 alias lt='ls -lt'
42 alias lrt='ls -lrt'
43 alias lat='ls -lat'
44 alias lart='ls -lart'
45 # List only directories and symbolic links that point to directories
46 alias lsd='ll -d *(-/DN)'
47
48 alias lscontext=l
49 cd () { __CHPWD_RUN_FIRST=lscontext && builtin cd "$@" && unset __CHPWD_RUN_FIRST }
50 #_cd_l() { ll }
51 #chpwd_functions+=_cd_l
52
53 # #183394
54 alias w='w|cat'
55
56 alias egrep='egrep --color=auto -d skip'
57 alias fgrep='fgrep --color=auto -d skip'
58 alias grep='grep --color=auto -d skip'
59
60 alias mmv='noglob zmv -W'
61 alias zcp='zmv -C'
62 alias zln='zmv -L'
63 alias zgmv='zmv -p git-mv'
64
65 alias cal='cal -3'
66 alias ftp=lftp
67
68 alias mbug='bts show --mbox'
69 alias bug='BROWSER=www-browser bts show'
70
71 # handy documentation lookup on Debian
72 # from http://www.michael-prokop.at/computer/config/.zshrc
73 doc() { cd /usr/share/doc/$1 && ls }
74 _doc() { _files -W /usr/share/doc -/ }
75 compdef _doc doc
76
77 alias giti='git init && git add . && git commit -minitial\ checkin && git tag orig'
78
79 if whence mtail >/dev/null; then
80   alias t=mtail
81 elif whence tailf >/dev/null; then
82   alias t=tailf
83 else
84   alias t='tail -f'
85 fi
86 alias tsl='t /var/log/syslog'
87 alias lsl='sensible-pager /var/log/syslog'
88 alias tml='t /var/log/mail.log'
89 alias lml='sensible-pager /var/log/mail.log'
90 alias tal='t /var/log/auth.log'
91 alias lal='sensible-pager /var/log/auth.log'
92 alias tdl='t /var/log/daemon.log'
93 alias ldl='sensible-pager /var/log/daemon.log'
94 alias tkl='t /var/log/kern.log'
95 alias lkl='sensible-pager /var/log/kern.log'
96
97 alias px='ps afux'
98 alias mps='ps -ao user,pcpu,start,command'
99
100 alias bofh='fortune bofh-excuses'
101
102 autoload -U baseconv
103 alias b2d='baseconv 2 10'
104 alias d2b='baseconv 10 2'
105 alias d2h='baseconv 10 16'
106 alias h2d='baseconv 16 10'
107 alias d2o='baseconv 10 8'
108 alias o2d='baseconv 8 10'
109
110 alias sendmail=/usr/sbin/sendmail
111
112 _d() { dict $* }
113 d() { _d $* | sensible-pager }
114 the() { d -d moby-thesaurus $* }
115 typeset -A _LANGUAGES
116 _LANGUAGES[en]=eng
117 _LANGUAGES[de]=deu
118 _LANGUAGES[es]=spa
119 _LANGUAGES[fr]=fra
120 _LANGUAGES[it]=ita
121 _LANGUAGES[lt]=lat
122 for l0 in ${(k)_LANGUAGES}; do
123   for l1 in ${(k)_LANGUAGES}; do
124     eval "_${l0}-${l1}() { _d -d fd-${_LANGUAGES[$l0]}-${_LANGUAGES[$l1]} \$* }"
125     eval "${l0}-${l1}() { d -d fd-${_LANGUAGES[$l0]}-${_LANGUAGES[$l1]} \$* }"
126   done
127 done
128 unset '_LANGUAGES[en]'
129 for l in ${(k)_LANGUAGES}; do
130   eval "${l}() { (_${l}-en \$*; _en-${l} \$*) | more }"
131 done
132 unset _LANGUAGES
133
134 alias dpkg-buildpackage="dpkg-buildpackage -k$DEBKEYID -rfakeroot"
135
136 bugsub() { echo X-debbugs-autosubscribe: madduck | sendmail -f $DEBEMAIL ${1:?No bug number}-subscribe@bugs.debian.org }
137 bugunsub() { sendmail -f $DEBEMAIL ${1:?No bug number}-unsubscribe@bugs.debian.org </dev/null }
138 ptssub() { echo subscribe ${1:?E: no package name given.} | sendmail -f ${2:-$DEBEMAIL} pts@qa.debian.org }
139 ptsunsub() { echo unsubscribe ${1:?E: no package name given.} | sendmail -f ${2:-$DEBEMAIL} pts@qa.debian.org }
140 qasub() { echo subscribe ${1:?E: no package name given.} ${2:-unspecifed} | sendmail -f $DEBEMAIL ddpo@qa.debian.org }
141 qaunsub() { echo unsubscribe ${1:?E: no package name given.} ${2:-unspecifed} | sendmail -f $DEBEMAIL ddpo@qa.debian.org }
142
143 uc() { unicode --max=0 --colour=off "$@" | sensible-pager }
144
145 alias ipr='ip r'
146 alias ipa='ip a'
147 alias ipl='ip l'
148
149 alias btd='btdownloadheadless'
150
151 alias mdtest='swaks -s localhost -t'
152
153 if whence devtodo >/dev/null; then
154   _devtodo_on_chpwd() {
155     local out; out="$(devtodo)"
156     [[ -n $out ]] && print "todo:\n$out"
157   }
158   [[ -z ${(M)chpwd_functions:#_devtodo_on_chpwd} ]] && chpwd_functions+=_devtodo_on_chpwd
159 fi
160
161 # vim:ft=zsh