Add directory environment config for chpwd
[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 directory-based-environment-configuration.zsh
29 git-extras.plugin.zsh
30 history-substring-search.zsh
31 per-directory-history.plugin.zsh
32 zaw.zsh
33 zsh-autosuggestions.zsh
34 )
35 for file in $plugins; do
36 debug "PLUGIN: Trying to load ${file}"...
37 source ${plugdir}/${file}
38 debug "PLUGIN: $fg_no_bold[green]done"
39 done
40 fi
41
42 # If the zsh-autosuggestions gets loaded, set another var
43 (( ${plugins[(I)zsh-autosuggestions.zsh]} )) \
44 && setvar ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE 'fg=green'
45
46 # And now (possibly) oh-my-zsh style plugins
47 if [[ -d ${ZDOTDIR}/plugins/ohmy ]]; then
48 typeset -a omplug
49 zstyle -a ':ganneff:config' ohmyplugins omplug
50 for plug in ${omplug}; do
51 if [[ -f ${ZDOTDIR}/plugins/ohmy/${plug}/${plug}.plugin.zsh ]]; then
52 source ${ZDOTDIR}/plugins/ohmy/${plug}/${plug}.plugin.zsh
53 fi
54 done
55 fi
56 } && __
57
58 unfunction bindkey