#zdep zfunct
### vim:ft=zsh:foldmethod=marker
###
### zsh aliases
###
### Frank Terbeck <ft@bewatermyfriend.org>
### Last-Modified: Thu Jul 17 10:55:54 2008
###
### URI: <http://ft.bewatermyfriend.org/comp/zsh.html>
###

### normal user aliases {{{
###   Note: normally aliases that redefine well-known commands are
###         not considered to be good practice, since other users might
###         get confused by changed environments. These ls- and grep-aliases
###         should be okay, since '--color=auto' only adds color sequences,
###         when the output goes to a terminal. ...smart little helpers, indeed. :-)
###
if [[ $(ls --version 2> /dev/null) == ((*GNU*)|(*fileutils*)|(*coreutils*)) ]] ; then
    alias ls='ls --color=auto'
    alias lsc='ls --color=always'
elif [[ -x $(which gls) ]] && [[ $(gls --version) == ((*GNU*)|(*fileutils*)|(*coreutils*)) ]] ; then
    alias ls='gls --color=auto'
    alias lsc='gls --color=always'
else
    xalias ls='ls -F'
fi
if echo zsh | grep --color=auto zsh > /dev/null 2>&1 ; then
    alias grep='grep --color=auto'
    alias grepc='grep --color=always'
fi
[[ -f ${HOME}/etc/x/aliasX ]] && \
    alias X='exec startx >& ${HOME}/.Xlog'

### a fresh zsh, please.
alias fzsh='PS1="zsh%% " zsh -f'

### generic aliases (ie. no special checks needed, using xalias().
xalias gpw="makepasswd --chars 12 --string 'abcdefghijklmnopqrrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+*%_-=.,!|/~'"
xalias gpwns="makepasswd --chars 12 --string 'abcdefghijklmnopqrrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-'"
xalias rot13='tr A-Za-z N-ZA-Mn-za-m'

### get status from cmus
xalias np='cmus-rstat.sh'

### the run-help alias is not defined in older versions
unalias run-help &> /dev/null

### }}}
### sudo aliases {{{

### reboot/halt/suspend
salias -c -o reboot='/sbin/reboot'
salias -c -o shutdown='/sbin/shutdown'
salias -c -o halt='/sbin/halt'
salias -c -o hibernate='/usr/sbin/hibernate'

### process control
salias -c -o kill='kill'
salias -c -o killall='killall'

### debian tools
if [[ -f /etc/debian_version ]] ; then
    salias -c -o aptitude='aptitude'
    salias -c -o apt-get='apt-get'
    salias -c -o apt-cache='apt-cache'
    salias -c -o apt-file='apt-file'
    salias -c -o apt-key='apt-key'
    salias -c -o apt-secure='apt-secure'
    salias -c -o ifup='/sbin/ifup'
    salias -c -o ifdown='/sbin/ifdown'
    salias -c -o pon='pon'
    salias -c -o poff='poff'
    salias -c -o plog='plog'
fi

### admin
salias -c -o cpufreq.sh='/home/hawk/bin/cpufreq.sh'
salias -c    do_bup='/home/hawk/bin/backup.zsh'
salias -c    cvpn='/home/hawk/bin/check_vpnc.sh'
salias -c    dvpn='vpnc-disconnect'
salias -c -o ifconfig='/sbin/ifconfig'


### network::misc
salias -c -o arping='/usr/sbin/arping'
salias -c -o nmap='nmap'
salias -c    sniff='tshark'
salias -c -o kismet='kismet'
salias -c -o kismet_server='kismet_server'
salias -c -o kismet_drone='kismet_drone'
salias -c -o kismet_client='kismet_client'

### abcde, for real-time features of cdda2wav
salias -c -o abcde='abcde'

### }}}
### names for certain directories {{{
###   you can do 'cd ~cmus' to cd to /usr/src/cmus, for example
###

xhashd audio=/mnt/audio
xhashd cmus=${HOME}/src/code/cmus
xhashd doc=/usr/share/doc
xhashd fvwm=${HOME}/etc/fvwm
xhashd git=/usr/src/git
xhashd howto=/usr/share/doc/HOWTO/en-txt
xhashd hs=/mnt/audio/hoerspiel
xhashd irssi=${HOME}/etc/irssi
xhashd music=/mnt/audio/music
xhashd mutt=${HOME}/etc/mutt
xhashd screen=${HOME}/etc/screen
xhashd slrn=${HOME}/etc/slrn
xhashd src=/usr/src
xhashd vim=${HOME}/etc/vim
xhashd web=/var/www
xhashd zdir=${${${(M)fpath:#*/zsh/${ZSH_VERSION}/*}[1]}%${ZSH_VERSION}*}${ZSH_VERSION}
xhashd zsh=${ZRC_SOURCE_DIR}

### }}}