33 lines
973 B
Plaintext
33 lines
973 B
Plaintext
![]() |
#!/bin/zsh
|
||
|
|
||
|
#################################################################################
|
||
|
# ZSH zle widget and custom function autloader
|
||
|
#################################################################################
|
||
|
#
|
||
|
# Lets you load custom functions and zle widgets split into single files.
|
||
|
#
|
||
|
# zle widgets are stored in the "widgets" folder in your configuration directory
|
||
|
# (default: /etc/zsh, if you want to use this in a user configuration file, set
|
||
|
# the variable $zcpath to your zsh configuration directory)
|
||
|
#
|
||
|
# functions are stored in the "functions" folder analogous.
|
||
|
#
|
||
|
|
||
|
ZWIDGETPATH=${ZWIDGETPATH:-"${zcpath:-/etc/zsh}/widgets"}
|
||
|
ZFUNCTIONPATH=${ZFUNCTIONPATH:-"${zcpath:-/etc/zsh}/functions"}
|
||
|
fpath+=( "${ZWIDGETPATH}" )
|
||
|
fpath+=( "${ZFUNCTIONPATH}" )
|
||
|
|
||
|
if [ -d $ZWIDGETPATH ]; then
|
||
|
for i in $ZWIDGETPATH/*(N:t); do
|
||
|
autoload -Uz $i
|
||
|
zle -N $i
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
if [ -d $ZFUNCTIONPATH ]; then
|
||
|
for i in $ZFUNCTIONPATH/*(N:t); do
|
||
|
autoload -Uz $i && $i
|
||
|
done
|
||
|
fi
|