[#67] Use outer variables for anonymous functions

The ability to pass arguments immediately to anonymous functions was added in
a newer Zsh version than the one that is shipped with Mac OS X Lion.
main
Sorin Ionescu 13 years ago
parent af983e9788
commit 3efd4b22c1

@ -32,8 +32,12 @@ function autoloadable {
# Loads Oh My Zsh modules.
function omodload {
local -a omodules
local omodule
# $argv is overridden in the anonymous function.
omodules=("$argv[@]")
function {
local ofunction
@ -41,17 +45,17 @@ function omodload {
setopt LOCAL_OPTIONS EXTENDED_GLOB
# Add functions to fpath.
fpath=(${argv:+${OMZ}/modules/${^argv}/functions(/FN)} $fpath)
fpath=(${omodules:+${OMZ}/modules/${^omodules}/functions(/FN)} $fpath)
# Load Oh My Zsh functions.
for ofunction in \
$OMZ/modules/${^argv}/functions/^([_.]*|prompt_*_setup|README*)(.N:t)
$OMZ/modules/${^omodules}/functions/^([_.]*|prompt_*_setup|README*)(.N:t)
do
autoload -Uz "$ofunction"
done
} "$argv[@]"
}
for omodule in "$argv[@]"; do
for omodule in "$omodules[@]"; do
if zstyle -t ":omz:module:$omodule" loaded; then
continue
elif [[ ! -d "$OMZ/modules/$omodule" ]]; then

Loading…
Cancel
Save