diff options
33 files changed, 215 insertions, 215 deletions
diff --git a/etc/.zprofile b/etc/.zprofile index ffdd0f1..cadc848 100644 --- a/etc/.zprofile +++ b/etc/.zprofile @@ -1,6 +1,6 @@ ## vim:ft=zsh function pr_info { - print -P "%F{cyan}>>%F{default} $*" + print -P "%F{cyan}>>%F{default} ${*}" } echo @@ -14,7 +14,7 @@ pr_info "This is %F{cyan}$(uname -srm)%F{default} on %F{cyan}%y%F{default}" echo [[ -n $(echo Maildir/new/*(N)) ]] && pr_info "You have mail!" -[[ -r $ZDIR/local-profile ]] && source $ZDIR/local-profile -[[ -r $ZDIR/hosts/profile-$HOST ]] && source $ZDIR/hosts/profile-$HOST +[[ -r ${ZDIR}/local-profile ]] && source ${ZDIR}/local-profile +[[ -r ${ZDIR}/hosts/profile-${HOST} ]] && source ${ZDIR}/hosts/profile-${HOST} unfunction pr_info diff --git a/etc/.zshenv b/etc/.zshenv index 45c601b..3ff22a6 100644 --- a/etc/.zshenv +++ b/etc/.zshenv @@ -1,15 +1,15 @@ ## vim:ft=zsh -: ${ZDIR:=$HOME/packages/zsh/etc} +: ${ZDIR:=${HOME}/packages/zsh/etc} PS4='%b%u%s%k%F{cyan}%N%F{default}:%F{yellow}%i%F{default}│' -fpath=($ZDIR/functions $ZDIR/completions $fpath) +fpath=(${ZDIR}/functions ${ZDIR}/completions ${fpath}) # Additional zshenv settings from caretaker -[[ -r $ZDIR/../provided/env ]] && source $ZDIR/../provided/env +[[ -r ${ZDIR}/../provided/env ]] && source ${ZDIR}/../provided/env export EDITOR==vim export MPD_HOST=mpd -export CALENDAR_DIR=$HOME/stuff +export CALENDAR_DIR=${HOME}/stuff export LESS='--silent --no-init --clear-screen --RAW-CONTROL-CHARS --quit-if-one-screen --ignore-case --tabs=5' # Required for various scripts @@ -17,10 +17,10 @@ export HOST export COLUMNS export LINES -if [[ -n $commands[lesspipe] ]] { +if [[ -n ${commands[lesspipe]} ]] { export LESSOPEN='| lesspipe %s' export LESSCLOSE='lesspipe %s %s' } # local settings, not tracked with git -[[ -r $ZDIR/local-env ]] && source $ZDIR/local-env +[[ -r ${ZDIR}/local-env ]] && source ${ZDIR}/local-env @@ -10,9 +10,9 @@ system=${$(uname):l} -alias 'linux:'='[[ $system == linux ]] &&' +alias 'linux:'='[[ ${system} == linux ]] &&' -if [[ $system == linux ]] { +if [[ ${system} == linux ]] { [[ -f /etc/debian_version ]] && distro=debian } @@ -20,7 +20,7 @@ if [[ $system == linux ]] { # {{{ Startup infos function zrc_info { - print -P "%F{red}>>%F{default} $*" + print -P "%F{red}>>%F{default} ${*}" } # }}} @@ -59,9 +59,9 @@ if [[ -d ~/var/cache/zsh ]] { ZCACHEDIR=~/.zsh-cache } -HISTFILE=$ZCACHEDIR/history +HISTFILE=${ZCACHEDIR}/history HISTSIZE=50000 -SAVEHIST=$HISTSIZE +SAVEHIST=${HISTSIZE} DIRSTACKSIZE=20 @@ -77,10 +77,10 @@ if (( EUID != 0)) { export MAKEFLAGS=j$(grep -c '^processor' /proc/cpuinfo) typeset -U path -path=(~/bin $path) +path=(~/bin ${path}) # Add manuals from caretaker to manpath -if [[ $distro == debian ]] { +if [[ ${distro} == debian ]] { if [[ -e ~/packages/catman ]] { export MANPATH=/var/cache/man } else { @@ -89,7 +89,7 @@ if [[ $distro == debian ]] { export MANWIDTH=100 } } - MANPATH+=":/usr/local/share/man:$HOME/packages/.collected/man" + MANPATH+=":/usr/local/share/man:${HOME}/packages/.collected/man" } # }}} @@ -139,8 +139,8 @@ export LS_COLORS autoload -U compinit autoload zargs zmv -if [[ -e $ZDIR/functions ]] { - autoload $ZDIR/functions/*(:t) +if [[ -e ${ZDIR}/functions ]] { + autoload ${ZDIR}/functions/*(:t) } else { # No cool extra stuff zrc_info "Running in standalone mode" @@ -175,15 +175,15 @@ function dirinfo { function xhashd { typeset directory=${~1#*\=} name=${1%%\=*} - if [[ -d $directory ]] { - hash -d $name=$directory + if [[ -d ${directory} ]] { + hash -d ${name}=${directory} } } # Note: local assignments (typeset foo=bar) are lost. export foo=bar works. function xsource { - if [[ -r $1 ]] { - source $1 + if [[ -r ${1} ]] { + source ${1} } } @@ -192,8 +192,8 @@ function Status Start Stop Restart Reload { if ((EUID)) { sudo=sudo } - for script in $*; { - $sudo /etc/init.d/$script ${0:l} + for script in ${*}; { + ${sudo} /etc/init.d/${script} ${0:l} } } @@ -252,9 +252,9 @@ xhashd web=~/public_html # {{{ Keys bindkey -e -[[ -z $terminfo[kdch1] ]] || bindkey -M emacs $terminfo[kdch1] delete-char -[[ -z $terminfo[khome] ]] || bindkey -M emacs $terminfo[khome] beginning-of-line -[[ -z $terminfo[kend] ]] || bindkey -M emacs $terminfo[kend] end-of-line +[[ -z ${terminfo[kdch1]} ]] || bindkey -M emacs ${terminfo[kdch1]} delete-char +[[ -z ${terminfo[khome]} ]] || bindkey -M emacs ${terminfo[khome]} beginning-of-line +[[ -z ${terminfo[kend]} ]] || bindkey -M emacs ${terminfo[kend]} end-of-line # }}} # {{{ Aliases @@ -270,8 +270,8 @@ alias_apps=( ) for meta in ${parameters[(I)mime_*]#mime_}; { - for format in $(eval echo "$"mime_$meta); { - alias -s $format=$alias_apps[$meta] + for format in $(eval echo "$"mime_${meta}); { + alias -s ${format}=${alias_apps[$meta]} } } @@ -376,7 +376,7 @@ alias fbif='fbi -a' alias fbij='fbi -a -u' for i in ~/var/gtd/*(.N); { - alias gtd-${i:t}='todo --database '$i + alias gtd-${i:t}='todo --database '${i} } alias lsi='feh --list' @@ -398,7 +398,7 @@ alias x='unsetopt bg_nice; startx &! exit' alias readahead='cat **/*(-.) > /dev/null' # }}} -if [[ $distro == debian ]] { #{{{ +if [[ ${distro} == debian ]] { #{{{ alias acse='apt-cache search' alias afse='apt-file search' @@ -480,29 +480,29 @@ chpwd # Show infos if requested (.xinitrc) if ((SHOW_INFO)) { - $ZDIR/../helpers/info + ${ZDIR}/../helpers/info } # }}} # {{{ Includes # no xsource here - typeset may be used -if [[ -e $ZDIR/../provided/includes ]] { - source $ZDIR/../provided/includes +if [[ -e ${ZDIR}/../provided/includes ]] { + source ${ZDIR}/../provided/includes } # local configuration, not in git -xsource $ZDIR/local +xsource ${ZDIR}/local -[[ -n $commands[envstore] ]] && eval $(envstore eval) +[[ -n ${commands[envstore]} ]] && eval $(envstore eval) # local configuration, in git -xsource $ZDIR/hosts/$HOST +xsource ${ZDIR}/hosts/${HOST} # }}} # {{{ Completion -zstyle ':completion:*' cache-path $ZCACHEDIR +zstyle ':completion:*' cache-path ${ZCACHEDIR} zstyle ':completion:*' use-cache true zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} @@ -530,17 +530,17 @@ zstyle ':completion:*:*:vi(m|):*' ignored-patterns \ 'a.out|*.o' # source: http://madism.org/~madcoder/dotfiles/zsh/40_completion -zstyle ':completion:*:processes' command 'ps -au$USER -o pid,time,cmd|grep -v "ps -au$USER -o pid,time,cmd"' +zstyle ':completion:*:processes' command 'ps -au${USER} -o pid,time,cmd|grep -v "ps -au${USER} -o pid,time,cmd"' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)[ 0-9:]#([^ ]#)*=01;30=01;31=01;38' zstyle ':completion:*:manuals' separate-sections true zstyle ':completion:*:manuals.*' insert-sections true -# $hosts is set from the hosts package +# ${hosts} is set from the hosts package zstyle ':completion:*' hosts ${(k)hosts} -[[ -e $ZCACHEDIR/compdump ]] || zrc_info "Creating completion cache" -compinit -C -d $ZCACHEDIR/compdump +[[ -e ${ZCACHEDIR}/compdump ]] || zrc_info "Creating completion cache" +compinit -C -d ${ZCACHEDIR}/compdump compdef _hosts sshmount compdef _functions reload diff --git a/etc/completions/__git_files b/etc/completions/__git_files index 44be686..062aefc 100644 --- a/etc/completions/__git_files +++ b/etc/completions/__git_files @@ -7,33 +7,33 @@ gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) __git_command_successful || return ls_opts=("--exclude-per-directory=.gitignore") -[[ -f "$gitdir/info/exclude" ]] && ls_opts+="--exclude-from=$gitdir/info/exclude" +[[ -f "${gitdir}/info/exclude" ]] && ls_opts+="--exclude-from=${gitdir}/info/exclude" -files=(${(ps:\0:)"$(cd $gitdir/..; _call_program files git ls-files -z $ls_opts $opts 2>/dev/null)"}) +files=(${(ps:\0:)"$(cd ${gitdir}/..; _call_program files git ls-files -z ${ls_opts} ${opts} 2>/dev/null)"}) __git_command_successful || return -if [[ -z $gitdir ]] { +if [[ -z ${gitdir} ]] { return 1 } if [[ ! -d .git ]] { dirdiff=${PWD#${gitdir%/.git}/} - for ((i = 1; i <= $#files; i++)) { + for ((i = 1; i <= ${#files}; i++)) { prefix='' item=(${(s:/:)files[$i]}) self=(${(s:/:)dirdiff}) for ((j = 1; j <= ${#self}; j++)) { - if [[ $item[$j] == $self[$j] ]] { + if [[ ${item[$j]} == ${self[$j]} ]] { item[$j]='' } else { prefix+='../' } } files[$i]=${prefix} - for j in $item; { - [[ -n $j ]] && files[$i]+="$j/" + for j in ${item}; { + [[ -n ${j} ]] && files[$i]+="${j}/" } files[$i]=${files[$i]%/} } } -_wanted files expl 'index file' _multi_parts $@ - / files +_wanted files expl 'index file' _multi_parts ${@} - / files diff --git a/etc/completions/_cryptsetup b/etc/completions/_cryptsetup index 5a327b3..9f75ec0 100644 --- a/etc/completions/_cryptsetup +++ b/etc/completions/_cryptsetup @@ -19,12 +19,12 @@ function _cryptsetup_mapping { function _cryptsetup_arguments { if (( CURRENT == 2 )) { - case $words[1] in + case ${words[1]} in create|remove|status|resize) _cryptsetup_mapping ;; luks(Format|Open|AddKey|RemoveKey|KillSlot|DelKey|UUID|Dump)|isLuks) _cryptsetup_device ;; esac } elif (( CURRENT == 3 )) { - case $words[1] in + case ${words[1]} in create) _cryptsetup_device ;; luksOpen) _cryptsetup_mapping ;; esac diff --git a/etc/completions/_fbi b/etc/completions/_fbi index 8af7fb0..7b0c675 100644 --- a/etc/completions/_fbi +++ b/etc/completions/_fbi @@ -36,7 +36,7 @@ arguments=( '*:file:_files' ) -_arguments -s $arguments +_arguments -s ${arguments} function _font () { typeset IFS=$'\n' diff --git a/etc/completions/_fbsetbg b/etc/completions/_fbsetbg index 93752c4..254e81f 100644 --- a/etc/completions/_fbsetbg +++ b/etc/completions/_fbsetbg @@ -28,8 +28,8 @@ file_arguments=( ) for arg in ${(k)file_arguments}; { - arguments+=$arg'[set '$file_arguments[$arg]' wallpaper]:file:_files' - arguments+=${arg:u}'[set '$file_arguments[$arg]' wallpaper (without remembering)]:file:_files' + arguments+=${arg}'[set '${file_arguments[$arg]}' wallpaper]:file:_files' + arguments+=${arg:u}'[set '${file_arguments[$arg]}' wallpaper (without remembering)]:file:_files' } -_arguments -s $arguments +_arguments -s ${arguments} diff --git a/etc/completions/_fbsetroot b/etc/completions/_fbsetroot index bc8903a..ddbc819 100644 --- a/etc/completions/_fbsetroot +++ b/etc/completions/_fbsetroot @@ -28,15 +28,15 @@ arguments=( - help '-help[print help]' - solid - '-solid[set root window to specified color]:color:'"($colors)" + '-solid[set root window to specified color]:color:'"(${colors})" - gradient - '-gradient[render texture string]:texturestring:'"($texturestrings)" - '-from[first grodient color]:color:'"($colors)" - '-to[second gradient color]:color:'"($colors)" + '-gradient[render texture string]:texturestring:'"(${texturestrings})" + '-from[first grodient color]:color:'"(${colors})" + '-to[second gradient color]:color:'"(${colors})" - mod '-mod[create modula pattern]:x: :y: ' - '-bg[modula background color]:color:'"($colors)" - '-fg[modula foreground color]:color:'"($colors)" + '-bg[modula background color]:color:'"(${colors})" + '-fg[modula foreground color]:color:'"(${colors})" ) -_arguments -s $arguments +_arguments -s ${arguments} diff --git a/etc/completions/_feh b/etc/completions/_feh index 064762e..97fff26 100644 --- a/etc/completions/_feh +++ b/etc/completions/_feh @@ -167,7 +167,7 @@ arguments=( ) for arg in ${(k)argument_pairs}; { - arguments+='(--'$arg')-'${argument_pairs[$arg]}${argument_postfix[$arg]} + arguments+='(--'${arg}')-'${argument_pairs[$arg]}${argument_postfix[$arg]} arguments+='(-'${argument_pairs[$arg]}[1]')--'${arg}${argument_postfix[$arg]} } @@ -177,9 +177,9 @@ function _feh_theme { typeset theme IFS=$'\n' for theme in $(grep "\w" ~/.fehrc | grep -v "^#"); do tmp=(${(s: :)theme}) - theme=$tmp[1] + theme=${tmp[1]} shift tmp - themes+=$theme:${(j: :)tmp} + themes+=${theme}:${(j: :)tmp} done _describe 'theme' themes fi @@ -197,4 +197,4 @@ function _feh_background { 'mode:mode:(trans)' } -_arguments -s $arguments +_arguments -s ${arguments} diff --git a/etc/completions/_gtd-move b/etc/completions/_gtd-move index e8cc804..7b25732 100644 --- a/etc/completions/_gtd-move +++ b/etc/completions/_gtd-move @@ -13,4 +13,4 @@ function _gtd_database { _path_files -W ~/var/gtd -g '*(.)' } -_arguments -s $arguments +_arguments -s ${arguments} diff --git a/etc/completions/_initd b/etc/completions/_initd index 61abd04..f44c0b7 100644 --- a/etc/completions/_initd +++ b/etc/completions/_initd @@ -19,9 +19,9 @@ if zstyle -t ':completion:*:*:_initd' all-files; then fi for file in /etc/init.d/*(*); { - read -u0 -k2 bang < $file && [[ $bang == '#!' ]] && - [[ -n ${${(j:|:s:|:)${(M)${(f)"$(< $file)"}:#[[:blank:]]#(\'|)(${~action}[[:blank:]]#\|[[:blank:]]#)#${~specific}([[:blank:]]#\|[[:blank:]]#${~action})#(\'|)\)}}//[^-a-z_]} ]] && + read -u0 -k2 bang < ${file} && [[ ${bang} == '#!' ]] && + [[ -n ${${(j:|:s:|:)${(M)${(f)"$(< ${file})"}:#[[:blank:]]#(\'|)(${~action}[[:blank:]]#\|[[:blank:]]#)#${~specific}([[:blank:]]#\|[[:blank:]]#${~action})#(\'|)\)}}//[^-a-z_]} ]] && scripts+=${file##*/} } -_wanted script expl script compadd $scripts +_wanted script expl script compadd ${scripts} diff --git a/etc/completions/_pkill b/etc/completions/_pkill index 150cf32..8f92fdc 100644 --- a/etc/completions/_pkill +++ b/etc/completions/_pkill @@ -27,7 +27,7 @@ arguments=( ':pattern:_named_process' ) -if [[ $service == 'pgrep' ]] { +if [[ ${service} == 'pgrep' ]] { arguments+='-d[set output delimiter]:delimiter' arguments+='-l[list process name]' } @@ -40,12 +40,12 @@ function _named_process { typeset -a pgrep_user typeset IFS=$'\n' if (( EUID )) { - pgrep_user=(-u $EUID) + pgrep_user=(-u ${EUID}) } _message 'pattern' _wanted pattern expl 'process name' \ - compadd ${$(pgrep $pgrep_user -l '')#* } + compadd ${$(pgrep ${pgrep_user} -l '')#* } } -_arguments -s $arguments +_arguments -s ${arguments} _signals -p diff --git a/etc/completions/_put b/etc/completions/_put index 0dec487..c5b19ca 100644 --- a/etc/completions/_put +++ b/etc/completions/_put @@ -3,10 +3,10 @@ typeset -a arguments typeset net -for net in $(grep '^hosts_' $ZDIR/functions/put | sed -r 's/^hosts_(\w*)=.*$/\1/'); { - arguments+="-$net" +for net in $(grep '^hosts_' ${ZDIR}/functions/put | sed -r 's/^hosts_(\w*)=.*$/\1/'); { + arguments+="-${net}" } arguments+=':file:_files' -_arguments -s $arguments +_arguments -s ${arguments} diff --git a/etc/completions/_sshfs b/etc/completions/_sshfs index e4e6aa7..b0adbaa 100644 --- a/etc/completions/_sshfs +++ b/etc/completions/_sshfs @@ -12,11 +12,11 @@ _remote_files () { if zstyle -T ":completion:${curcontext}:files" remote-access; then zparseopts -D -E -a args p: 1 2 4 6 F: - if [[ -z $QIPREFIX ]] + if [[ -z ${QIPREFIX} ]] then rempat="${PREFIX%%[^./][^/]#}\*" else rempat="${(q)PREFIX%%[^./][^/]#}\*" fi - remfiles=(${(M)${(f)"$(_call_program files ssh -o BatchMode=yes $args -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) + remfiles=(${(M)${(f)"$(_call_program files ssh -o BatchMode=yes ${args} -a -x ${IPREFIX%:} ls -d1FL "${rempat}" 2>/dev/null)"}%%[^/]#(|/)}) compset -P '*/' compset -S '/*' || suf='remote file' @@ -26,9 +26,9 @@ _remote_files () { _tags files while _tags; do while _next_label files expl ${suf:-remote directory}; do - [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ + [[ -n ${suf} ]] && compadd "${@}" "${expl[@]}" -d remdispf \ ${(q)remdispf%[*=@|]} && ret=0 - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ + compadd ${suf:+-S/} "${@}" "${expl[@]}" -d remdispd \ ${(q)remdispd%/} && ret=0 done (( ret )) || return 0 @@ -53,7 +53,7 @@ _arguments \ ':mountpoint:_files -/' _ssh_users () { - _combination -s '[:@]' my-accounts users-hosts users "$@" + _combination -s '[:@]' my-accounts users-hosts users "${@}" } _ssh_hosts () { @@ -62,40 +62,40 @@ _ssh_hosts () { integer ind # If users-hosts matches, we shouldn't complete anything else. - if [[ "$IPREFIX" == *@ ]]; then - _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return + if [[ "${IPREFIX}" == *@ ]]; then + _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "${@}" && return else _combination -s '[:@]' my-accounts users-hosts \ - ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return + ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "${@}" && return fi if (( ind = ${words[(I)-F]} )); then config=${~words[ind+1]} else - config="$HOME/.ssh/config" + config="${HOME}/.ssh/config" fi - if [[ -r $config ]]; then + if [[ -r ${config} ]]; then local IFS=$'\t ' key hosts host while read key hosts; do - if [[ "$key" == (#i)host ]]; then + if [[ "${key}" == (#i)host ]]; then for host in ${(z)hosts}; do - case $host in + case ${host} in (*[*?]*) ;; - (*) config_hosts+=("$host") ;; + (*) config_hosts+=("${host}") ;; esac done fi - done < "$config" + done < "${config}" if (( ${#config_hosts} )); then _wanted hosts expl 'remote host name' \ - compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts + compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "${@}" ${config_hosts} fi fi } -while [[ -n $state ]]; do - lstate=$state +while [[ -n ${state} ]]; do + lstate=${state} state='' - case $lstate in + case ${lstate} in userhost) if compset -P '*:'; then _remote_files ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0 @@ -111,7 +111,7 @@ while [[ -n $state ]]; do fi _alternative \ 'hosts:remote host name:_ssh_hosts -S :' \ - "$tmp[@]" + "${tmp[@]}" fi ;; esac diff --git a/etc/completions/_toshset b/etc/completions/_toshset index 6c48d45..c23d76c 100644 --- a/etc/completions/_toshset +++ b/etc/completions/_toshset @@ -45,4 +45,4 @@ arguments=( '-trmode[toggle display transflective mode]' ) -_arguments -s $arguments +_arguments -s ${arguments} diff --git a/etc/functions/colortable b/etc/functions/colortable index fadd7a7..ab46eb4 100644 --- a/etc/functions/colortable +++ b/etc/functions/colortable @@ -2,7 +2,7 @@ ## print a table with all 256 color codes for i in {0..255}; { - printf " %s%-3s" $'\e[38;5;'${i}m $i + printf " %s%-3s" $'\e[38;5;'${i}m ${i} (( (i+1) % (COLUMNS/4) < 1 )) && echo } echo diff --git a/etc/functions/dpkg-hold b/etc/functions/dpkg-hold index b905114..6e98e87 100644 --- a/etc/functions/dpkg-hold +++ b/etc/functions/dpkg-hold @@ -1 +1 @@ -echo $1 hold | sudo dpkg --set-selections +echo ${1} hold | sudo dpkg --set-selections diff --git a/etc/functions/dpkg-unhold b/etc/functions/dpkg-unhold index 7bc785b..791c8aa 100644 --- a/etc/functions/dpkg-unhold +++ b/etc/functions/dpkg-unhold @@ -1 +1 @@ -echo $1 install | sudo dpkg --set-selections +echo ${1} install | sudo dpkg --set-selections diff --git a/etc/functions/extract b/etc/functions/extract index 9312678..2156dab 100644 --- a/etc/functions/extract +++ b/etc/functions/extract @@ -2,25 +2,25 @@ ## Extract archives ## Usage: extr <file> -if [[ -f $1 ]] { - case $1 in - *.(tar.bz2|tbz2)) tar xvjf $* ;; - *.(tar.gz|tgz)) tar xvzf $* ;; - *.tar.lzma) unlzma $1 | tar xv ;; - *.ace) unace e $1 ;; - *.rar) unrar x $1 ;; - *.deb) ar -x $1 ;; - *.bz2) bunzip2 $1 ;; - *.lzh) lha x $1 ;; - *.gz) gunzip $1 ;; - *.tar) tar xvf $* ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1 ;; - *.cpio) cpio --no-absolute-filenames -idv < $1 ;; - *.lzma) unlzma $1 ;; - *) echo "Unknown archive type: $1"; return 2 ;; +if [[ -f ${1} ]] { + case ${1} in + *.(tar.bz2|tbz2)) tar xvjf ${*} ;; + *.(tar.gz|tgz)) tar xvzf ${*} ;; + *.tar.lzma) unlzma ${1} | tar xv ;; + *.ace) unace e ${1} ;; + *.rar) unrar x ${1} ;; + *.deb) ar -x ${1} ;; + *.bz2) bunzip2 ${1} ;; + *.lzh) lha x ${1} ;; + *.gz) gunzip ${1} ;; + *.tar) tar xvf ${*} ;; + *.zip) unzip ${1} ;; + *.Z) uncompress ${1} ;; + *.cpio) cpio --no-absolute-filenames -idv < ${1} ;; + *.lzma) unlzma ${1} ;; + *) echo "Unknown archive type: ${1}"; return 2 ;; esac } else { - echo "No such file: $1" + echo "No such file: ${1}" return 1 } diff --git a/etc/functions/finfo b/etc/functions/finfo index 62a5fe9..f0c9429 100644 --- a/etc/functions/finfo +++ b/etc/functions/finfo @@ -4,11 +4,11 @@ ## Usage: finfo <function name> typeset line -whichf $1 &> /dev/null || return 1 +whichf ${1} &> /dev/null || return 1 while read line; do - [[ $line == \#* ]] || break - [[ $line == *vim:ft=* ]] && continue - [[ $line == \#(autoload|compdef)* ]] && continue + [[ ${line} == \#* ]] || break + [[ ${line} == *vim:ft=* ]] && continue + [[ ${line} == \#(autoload|compdef)* ]] && continue echo ${line#(\#|)\# } -done < $(whichf $1) +done < $(whichf ${1}) diff --git a/etc/functions/gtd-all b/etc/functions/gtd-all index ddbfdba..3cbdde5 100644 --- a/etc/functions/gtd-all +++ b/etc/functions/gtd-all @@ -5,8 +5,8 @@ typeset prefix=~/var/gtd typeset database typeset -i force -while [[ $1 == -* ]] { - case $1 in +while [[ ${1} == -* ]] { + case ${1} in -|--) shift; break ;; --force) force=1 ;; esac @@ -26,7 +26,7 @@ function gtd_grep { return 0 } -for database in $prefix/*(.N); { +for database in ${prefix}/*(.N); { echo "\n${database:t}" - todo --database $database $* | gtd_grep + todo --database ${database} ${*} | gtd_grep } diff --git a/etc/functions/gtd-move b/etc/functions/gtd-move index fa03800..eed7861 100644 --- a/etc/functions/gtd-move +++ b/etc/functions/gtd-move @@ -9,14 +9,14 @@ if [[ ${#*} != 3 ]] { return } -typeset prefix="$HOME/var/gtd" +typeset prefix="${HOME}/var/gtd" typeset format='display=%T\n%p' -typeset from=$1 -typeset itemno=$2 -typeset to=$3 +typeset from=${1} +typeset itemno=${2} +typeset to=${3} typeset IFS=$'\n' typeset -a item -item=($(todo --database $prefix/$from --format $format $itemno)) -todo --database $prefix/$to --priority $item[2] --add $item[1] -todo --database $prefix/$from --remove $itemno +item=($(todo --database ${prefix}/${from} --format ${format} ${itemno})) +todo --database ${prefix}/${to} --priority ${item[2]} --add ${item[1]} +todo --database ${prefix}/${from} --remove ${itemno} diff --git a/etc/functions/help b/etc/functions/help index db3eca1..bad1b75 100644 --- a/etc/functions/help +++ b/etc/functions/help @@ -6,47 +6,47 @@ typeset method topic typeset -i found check_only all methods=(man zshfunction zshbuiltin apt) -while [[ $1 == -* ]] { - case $1 in +while [[ ${1} == -* ]] { + case ${1} in -a|--all) all=1 ;; -c|--check-only) check_only=1 ;; - -t|--topic) topic=$2; shift ;; + -t|--topic) topic=${2}; shift ;; -|--) shift; break ;; - *) echo "unknown option: $1" ;; + *) echo "unknown option: ${1}" ;; esac shift } -function help_check_man { man -w $1 &> /dev/null } -function help_check_zshfunction { whichf $1 &> /dev/null } +function help_check_man { man -w ${1} &> /dev/null } +function help_check_zshfunction { whichf ${1} &> /dev/null } function help_check_zshbuiltin { (( ${+builtins[$1]} )) } function help_check_apt { - [[ $commands[$1] != ${HOME}* ]] && [[ -n $commands[$1] ]] && [[ -n $commands[apt-file ]] + [[ ${commands[$1]} != ${HOME}* ]] && [[ -n ${commands[$1]} ]] && [[ -n ${commands[apt-file]} ]] } -function help_show_man { man $1 } -function help_show_zshfunction { finfo $1 } -function help_show_zshbuiltin { man zshbuiltins | less -p " $1" } +function help_show_man { man ${1} } +function help_show_zshfunction { finfo ${1} } +function help_show_zshbuiltin { man zshbuiltins | less -p " ${1}" } function help_show_apt { - apt-cache show ${(s/:/)$(apt-file search -F $commands[$1])[1]} + apt-cache show ${(s/:/)$(apt-file search -F ${commands[$1]})[1]} } -if [[ -z $1 ]] { +if [[ -z ${1} ]] { echo "Usage: help <command>" > /dev/stderr return 1 } -for method in $methods; { - if [[ -n $topic && $method != $topic ]] { +for method in ${methods}; { + if [[ -n ${topic} && ${method} != ${topic} ]] { continue } - if help_check_$method $1; then + if help_check_${method} ${1}; then ((found++)) if ((check_only)) { - echo $method + echo ${method} continue } - help_show_$method $1 + help_show_${method} ${1} ((all)) || break fi } diff --git a/etc/functions/mkcd b/etc/functions/mkcd index bd6158d..e91719a 100644 --- a/etc/functions/mkcd +++ b/etc/functions/mkcd @@ -1,13 +1,13 @@ ## vim:ft=zsh ## create a directory, then change into it typeset -i ls=0 -typeset dir=$1 +typeset dir=${1} -if [[ -z $dir ]] { +if [[ -z ${dir} ]] { echo "Usage: mkcd <directory name>" > /dev/stderr return 1 } -if [[ -d $dir ]] ls=1 -mkdir -p $dir -cd $dir +if [[ -d ${dir} ]] ls=1 +mkdir -p ${dir} +cd ${dir} if ((ls)) ls --color=auto diff --git a/etc/functions/need-comp b/etc/functions/need-comp index a38b561..9326157 100644 --- a/etc/functions/need-comp +++ b/etc/functions/need-comp @@ -1,9 +1,9 @@ ## vim:ft=zsh check_comp() { - ((! $+_comps[$1])) && print $1 + ((! ${+_comps[$1]})) && print ${1} } { - for f ($^path/*(N:t)) check_comp $f + for f (${^path}/*(N:t)) check_comp ${f} } | sort diff --git a/etc/functions/newsbeuter b/etc/functions/newsbeuter index 3756183..d010b82 100644 --- a/etc/functions/newsbeuter +++ b/etc/functions/newsbeuter @@ -2,11 +2,11 @@ ## wrapper around newsbeuter to keep the feeds in sync function __sync { - if [[ $HOST != aneurysm ]] { + if [[ ${HOST} != aneurysm ]] { unisync unison aneurysm .newsbeuter } } __sync || return 1 -command newsbeuter $* +command newsbeuter ${*} __sync diff --git a/etc/functions/off b/etc/functions/off index 1edd2d8..adf666f 100644 --- a/etc/functions/off +++ b/etc/functions/off @@ -11,14 +11,14 @@ typeset -i force reboot simulate exit_ok=1 function execute { if (( simulate )) { - echo $* + echo ${*} } else { - $* || exit_ok=0 + ${*} || exit_ok=0 } } -while [[ $1 == -* ]] { - case $1 in +while [[ ${1} == -* ]] { + case ${1} in -n) simulate=1 ;; -r) reboot=1 ;; --force) force=1 ;; @@ -33,13 +33,13 @@ while [[ $1 == -* ]] { return 0 ;; -|--) shift; break ;; - *) echo "Unrecognized option: $1" >&2 ; return 1 ;; + *) echo "Unrecognized option: ${1}" >&2 ; return 1 ;; esac shift } # Don't shut down a server too easily -if [[ $force != 1 && $hosts[$HOST] == *:server:* ]] { +if [[ ${force} != 1 && ${hosts[$HOST]} == *:server:* ]] { print -P '%B%F{yellow}This seems to be a server... not shutting down%f%b' echo "Use 'off --force' if you really mean it" return 1 @@ -52,16 +52,16 @@ fi execute uinit -o text stop-all while read filesystem garbage; do - if [[ $garbage == *[12] ]] && fgrep -q $filesystem /etc/mtab; then - filesystems+=$filesystem + if [[ ${garbage} == *[12] ]] && fgrep -q ${filesystem} /etc/mtab; then + filesystems+=${filesystem} fi done < /etc/fstab -for filesystem in $filesystems; { - tune2fs=($(sudo tune2fs -l $filesystem | fgrep -i 'mount count' | grep -o '[0-9]*')) +for filesystem in ${filesystems}; { + tune2fs=($(sudo tune2fs -l ${filesystem} | fgrep -i 'mount count' | grep -o '[0-9]*')) if (( tune2fs[2] - tune2fs[1] < 5 )) { exit_ok=0 - echo "notice: filesystem $filesystem due to check in $((tune2fs[2] - tune2fs[1])) mounts" + echo "notice: filesystem ${filesystem} due to check in $((tune2fs[2] - tune2fs[1])) mounts" } } if (( reboot )) { diff --git a/etc/functions/plonkhost b/etc/functions/plonkhost index d3020ed..6f62541 100644 --- a/etc/functions/plonkhost +++ b/etc/functions/plonkhost @@ -1,4 +1,4 @@ ## vim:ft=zsh ## "plonk" (as in ignore) a host via iptables ## Usage: plonkhost <host> -sudo iptables -I INPUT -s "$1" -j DROP +sudo iptables -I INPUT -s "${1}" -j DROP diff --git a/etc/functions/put b/etc/functions/put index 1876852..4fe8279 100644 --- a/etc/functions/put +++ b/etc/functions/put @@ -11,7 +11,7 @@ typeset target_dir server_prefix typeset file remote_file illegal typeset -i n_hosts n_ping n_curl -if [[ -z $commands[curl] ]]; then +if [[ -z ${commands[curl]} ]]; then function curl {return 0} print -P "%B%F{yellow}curl not present, won't be able to check upload success%f%b" fi @@ -38,8 +38,8 @@ function put_becquerel () { hosts=(aneurysm_int aneurysm becquerel) hosts_nossl=(becquerel) -while [[ $1 == -* ]] { - case $1 in +while [[ ${1} == -* ]] { + case ${1} in -|--) shift; break ;; *) (( $(eval echo '$#'hosts_${1#-}) )) && eval hosts=\(\$hosts_${1#-}\) @@ -49,21 +49,21 @@ while [[ $1 == -* ]] { } -n_hosts=$#hosts -if [[ -f $1 ]] { - file=$1 - while (( $#hosts )) { +n_hosts=${#hosts} +if [[ -f ${1} ]] { + file=${1} + while (( ${#hosts} )) { remote_file=${file:t} - put_$hosts[1] - ping -c 1 $hostname &> /dev/null || ping6 -c 1 $hostname &> /dev/null + put_${hosts[1]} + ping -c 1 ${hostname} &> /dev/null || ping6 -c 1 ${hostname} &> /dev/null if (( ? == 0 )) { - if [[ $remote_file == ${~illegal} ]] { + if [[ ${remote_file} == ${~illegal} ]] { remote_file=${remote_file:r} } - scp $ssh_options $file $hostname:$target_dir/$remote_file - ssh $ssh_options $hostname "chmod 644 $target_dir$remote_file" - if $(curl -fI $server_prefix$remote_file &> /dev/null); then - echo $server_prefix$remote_file + scp ${ssh_options} ${file} ${hostname}:${target_dir}/${remote_file} + ssh ${ssh_options} ${hostname} "chmod 644 ${target_dir}${remote_file}" + if $(curl -fI ${server_prefix}${remote_file} &> /dev/null); then + echo ${server_prefix}${remote_file} return 0 else (( n_curl++ )) @@ -73,11 +73,11 @@ if [[ -f $1 ]] { } shift hosts } - echo "Tried uploading to $n_hosts hosts without success" >&2 - ((n_ping)) && echo " - $n_ping hosts are unreachable" >&2 - ((n_curl)) && echo " - $n_curl errors while uploading" >&2 + echo "Tried uploading to ${n_hosts} hosts without success" >&2 + ((n_ping)) && echo " - ${n_ping} hosts are unreachable" >&2 + ((n_curl)) && echo " - ${n_curl} errors while uploading" >&2 return 1 } else { - echo "$1: No such file" + echo "${1}: No such file" return 1 } diff --git a/etc/functions/reload b/etc/functions/reload index afa634f..20439c2 100644 --- a/etc/functions/reload +++ b/etc/functions/reload @@ -7,8 +7,8 @@ if [[ ${#*} == 0 ]] { rehash } else { local function - for function in $@; { - unfunction $function - autoload $function + for function in ${@}; { + unfunction ${function} + autoload ${function} } } diff --git a/etc/functions/rtab b/etc/functions/rtab index 7444fef..4ba828a 100644 --- a/etc/functions/rtab +++ b/etc/functions/rtab @@ -27,8 +27,8 @@ zstyle -t ':prompt:rtab' last && lastfull=1 zstyle -t ':prompt:rtab' short && short=1 zstyle -t ':prompt:rtab' tilde && tilde=1 -while [[ $1 == -* ]]; do - case $1 in +while [[ ${1} == -* ]]; do + case ${1} in -f|--fish) lastfull=1 short=1 @@ -61,32 +61,32 @@ while [[ $1 == -* ]]; do done typeset -a tree expn -typeset result part dir=${1-$PWD} +typeset result part dir=${1-${PWD}} typeset -i i -[[ -d $dir ]] || return 0 +[[ -d ${dir} ]] || return 0 if (( named )) { for part in ${(k)nameddirs}; { - [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~$part} + [[ ${dir} == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~${part}} } } -(( tilde )) && dir=${dir/#$HOME/\~} +(( tilde )) && dir=${dir/#${HOME}/\~} tree=(${(s:/:)dir}) ( unfunction chpwd 2> /dev/null # Start either in the currrent named directory or in / - if [[ $tree[1] == \~* ]] { + if [[ ${tree[1]} == \~* ]] { cd ${~tree[1]} - result=$tree[1] + result=${tree[1]} shift tree } else { cd / } - for dir in $tree; { - if (( lastfull && $#tree == 1 )) { - result+="/$tree" + for dir in ${tree}; { + if (( lastfull && ${#tree} == 1 )) { + result+="/${tree}" break } @@ -94,19 +94,19 @@ tree=(${(s:/:)dir}) expn=(a b) part='' i=0 - until [[ (( ${#expn} == 1 )) || $dir == $expn || $i -gt 99 ]] do + until [[ (( ${#expn} == 1 )) || ${dir} == ${expn} || ${i} -gt 99 ]] do (( i++ )) - part+=$dir[$i] + part+=${dir[$i]} expn=($(echo ${part}*(-/))) # Never show a single . as directory - if [[ $i == 1 && $dir[$i] == . ]] { + if [[ ${i} == 1 && ${dir[$i]} == . ]] { expn=(a b) - } elif [[ $short == 1 ]] { + } elif [[ ${short} == 1 ]] { break } done - result+="/$part" - cd $dir + result+="/${part}" + cd ${dir} shift tree } echo ${result:-/} diff --git a/etc/functions/whichf b/etc/functions/whichf index 01026c4..03bcbb7 100644 --- a/etc/functions/whichf +++ b/etc/functions/whichf @@ -1,7 +1,7 @@ ## vim:ft=zsh ## locate the file corresponding to a function -if [[ -n $(echo ${^fpath}/$1(-.N)) ]] { - echo ${^fpath}/$1(-.N) +if [[ -n $(echo ${^fpath}/${1}(-.N)) ]] { + echo ${^fpath}/${1}(-.N) } else { return 1 } @@ -1,5 +1,5 @@ ## vim:ft=zsh -if [[ -z $SSH_CONNECTION && ! -e /tmp/.x-started ]] { +if [[ -z ${SSH_CONNECTION} && ! -e /tmp/.x-started ]] { touch /tmp/.x-started unsetopt bg_nice xinit /home/derf/.xinitrc -- /etc/X11/xinit/xserverrc :0 -auth $(mktemp --tmpdir serverauth.XXXXXXXXXX) &! exit |