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