813b97d4fa12e8129dfb307a535e4ec626a4ef82
[zsh.git] / .zsh / 70_Plugins.zsh
1 # -*- mode: sh;-*-
2
3 # Config for plugins loaded below
4
5
6 # for per-directory-history
7 HISTORY_BASE=${ZDOTDIR}/var/dirhist
8 mkdir -p ${HISTORY_BASE}
9
10 function bindkey() {
11 if zstyle -t ':ganneff:config' pluginbindkeys; then
12 # User allows plugins to bind keys
13 builtin bindkey "$@"
14 [[ "${DEBUG}" = "no" ]] && return
15 print -b -r "$fg_no_bold[cyan]plugin allowed to run${reset_color}: 'bindkey ${(q)@}'"
16 else
17 [[ "${DEBUG}" = "no" ]] && return
18 print -b -r "$fg_no_bold[red]plugin forbidden to run${reset_color}: 'bindkey ${(q)@}'"
19 fi
20 }
21
22 __ () {
23 local plugdir=${ZDOTDIR}/plugins
24 if [ -d ${plugdir} ]; then
25 typeset -a plugins
26 zstyle -a ':ganneff:config' plugins plugins \
27 || plugins=(
28 git-extras.plugin.zsh
29 history-substring-search.zsh
30 per-directory-history.plugin.zsh
31 )
32 for file in $plugins; do
33 debug "PLUGIN: Trying to load ${file}"...
34 source ${plugdir}/${file}
35 debug "PLUGIN: $fg_no_bold[green]done"
36 done
37 fi
38
39 # And now (possibly) oh-my-zsh style plugins
40 if [[ -d ${ZDOTDIR}/plugins/ohmy ]]; then
41 typeset -a omplug
42 zstyle -a ':ganneff:config' ohmyplugins omplug
43 for plug in ${omplug}; do
44 if [[ -f ${ZDOTDIR}/plugins/ohmy/${plug}/${plug}.plugin.zsh ]]; then
45 source ${ZDOTDIR}/plugins/ohmy/${plug}/${plug}.plugin.zsh
46 fi
47 done
48 fi
49 } && __
50
51 unfunction bindkey
52