function output() {
emulate -L zsh
local title="$@"
- local output=(${(f)"$(cat)"})
+ local output; output=(${(f)"$(cat)"})
[[ ${#output} -ge 1 ]] || return
eval git diff $common_options "$@" 2>/dev/null
}
- local cached=(${(f)"$(gitdiffstat --cached | output cached)"})
- local changed=(${(f)"$(gitdiffstat | output changed)"})
+ local cached; cached=(${(f)"$(gitdiffstat --cached | output cached)"})
+ local changed; changed=(${(f)"$(gitdiffstat | output changed)"})
local max=${#changed}
[[ $max -lt ${#cached} ]] && max=${#cached}
local arrayname="$1"; shift
local i
for i; do
- eval "typeset -ga $arrayname=(\$i \${$arrayname[@]/\$i})"
+ eval "typeset -ga $arrayname; $arrayname=(\$i \${$arrayname[@]/\$i})"
done
}
local arrayname="$1"; shift
local i
for i; do
- eval "typeset -ga $arrayname=(\${$arrayname[@]/\$i} \$i)"
+ eval "typeset -ga $arrayname; $arrayname=(\${$arrayname[@]/\$i} \$i)"
done
}
# Source repository: http://git.madduck.net/v/etc/zsh.git
#
-typeset -la common_perms=(rw- rwx r-- r-x r-s rws)
+typeset -la common_perms
+common_perms=(rw- rwx r-- r-x r-s rws)
local perm
for perm in $common_perms; do
eval alias $perm="'chmod $perm'"
echo ${var#*\#}
}
-typeset -lA bases=(b 2 o 8 d 10 h 16)
+typeset -lA bases
+bases=(b 2 o 8 d 10 h 16)
typeset -l {k,v}{1,2}
for k1 v1 in ${(kv)bases}; do
for k2 v2 in ${(kv)bases}; do
# a couple commands don't yet have -option completion but
# they're generic GNU tools, so…
-typeset -la gnu_generic_tools=(mv)
+typeset -la gnu_generic_tools
+gnu_generic_tools=(mv)
local c
for c ($gnu_generic_tools) compdef _gnu_generic $c
-unalias getpw
+unalias getpw 2>/dev/null
getpw() {
if ! pass -c "$@"; then
if old-getpw "$@"; then
#
autoload -Uz promptinit
-declare -la fpath_saved=($fpath)
+declare -la fpath_saved
+fpath_saved=($fpath)
fpath+=$ZDOTDIR/themes
promptinit
prompt madduck