1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-23 01:17:59 +00:00

[#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.
This commit is contained in:
Sorin Ionescu 2012-05-07 22:19:20 -04:00
parent af983e9788
commit 3efd4b22c1

View File

@ -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