1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 20:57:59 +00:00

[Fix #76] Load Zsh functions, modules in zshrc

This commit is contained in:
Sorin Ionescu 2012-03-30 15:45:44 -04:00
parent afca9425b9
commit cf5fb88b39
2 changed files with 24 additions and 10 deletions

View File

@ -30,6 +30,20 @@ fpath=(
$fpath $fpath
) )
# Autoload Zsh modules.
zstyle -a ':omz:load' module 'zsh_modules'
for zsh_module in "$zsh_modules[@]"; do
zmodload "${(z)zsh_module}"
done
unset zsh_modules zsh_module
# Autoload Zsh functions.
zstyle -a ':omz:load' function 'zsh_functions'
for zsh_function in "$zsh_functions[@]"; do
autoload -Uz "$zsh_function"
done
unset zsh_functions zsh_function
# Load and initialize the completion system ignoring insecure directories. # Load and initialize the completion system ignoring insecure directories.
autoload -Uz compinit && compinit -i autoload -Uz compinit && compinit -i
@ -45,12 +59,6 @@ source "${0:h}/spectrum.zsh"
source "${0:h}/alias.zsh" source "${0:h}/alias.zsh"
source "${0:h}/utility.zsh" source "${0:h}/utility.zsh"
# Autoload Zsh functions.
autoload -Uz age
autoload -Uz zargs
autoload -Uz zcalc
autoload -Uz zmv
# Source plugins defined in ~/.zshrc. # Source plugins defined in ~/.zshrc.
for plugin in "$plugins[@]"; do for plugin in "$plugins[@]"; do
if [[ ! -d "${0:h}/plugins/$plugin" ]]; then if [[ ! -d "${0:h}/plugins/$plugin" ]]; then
@ -70,12 +78,12 @@ unset plugin plugins
# Autoload Oh My Zsh functions. # Autoload Oh My Zsh functions.
for fdir in "$fpath[@]"; do for fdir in "$fpath[@]"; do
if [[ "$fdir" == ${0:h}/(|*/)functions ]]; then if [[ "$fdir" == ${0:h}/(|*/)functions ]]; then
for func in $fdir/[^_.]*(N.:t); do for omz_function in $fdir/[^_.]*(N.:t); do
autoload -Uz $func autoload -Uz "$omz_function"
done done
fi fi
done done
unset fdir func unset fdir omz_function
# Set environment variables for launchd processes. # Set environment variables for launchd processes.
if [[ "$OSTYPE" == darwin* ]]; then if [[ "$OSTYPE" == darwin* ]]; then

View File

@ -20,7 +20,13 @@ zstyle ':omz:*:*' color 'yes'
# Auto set the tab and window titles. # Auto set the tab and window titles.
zstyle ':omz:terminal' auto-title 'yes' zstyle ':omz:terminal' auto-title 'yes'
# Set the plugins to load (see $OMZ/plugins/). # Set the Zsh modules to load (man zshmodules).
# zstyle ':omz:load' module 'attr' 'stat'
# Set the Zsh functions to load (man zshcontrib).
# zstyle ':omz:load' function 'zargs' 'zmv'
# Set the plugins to load (browse plugins).
zstyle ':omz:load' plugin 'archive' 'git' zstyle ':omz:load' plugin 'archive' 'git'
# Set the prompt theme to load. # Set the prompt theme to load.