# Prezto module
type="init.zsh"
fname="$dname/init.zsh"
+ elif [[ -r "$dname/$plugin.zsh-theme" ]]; then
+ # ZSH "theme plugin", ignore here!
+ :
else
echo "AX-ZSH plugin type of \"$plugin\" unknown, skipped!" >&2
return 0
ax_msg - "Cloning plugin from GitHub ..."
git clone "https://github.com/$1.git" \
"$AXZSH/repos/$plugin"
+ # Try to enable a theme in this "foreign" plugin, but
+ # ignore errors: we don't know if this plugin provides
+ # a theme at all ...
+ SetTheme "${plugin#*#}" 2>/dev/null
fi
fi
elif [ -r "$AXZSH/themes/$1.axzshtheme" ]; then
theme="$AXZSH/themes/$1.axzshtheme"
else
- echo "Theme \"$1\" not found!"
- return 1
+ # Look for theme inside of installed plugins:
+ for dname (
+ "$AXZSH/custom_plugins/"*(N)
+ "$AXZSH/repos/"*(N)
+ ); do
+ if [[ -r "$dname/$1.axzshtheme" ]]; then
+ theme="$dname/$1.axzshtheme"
+ break
+ elif [[ -r "$dname/$1.zsh-theme" ]]; then
+ theme="$dname/$1.zsh-theme"
+ break
+ fi
+ done
+ if [[ -z "$theme" ]]; then
+ echo "Theme \"$1\" not found!"
+ return 1
+ fi
fi
ln -sv "$theme" "$link_name" || return 1
return $?
'args')
case "$words[2]" in
"enable-plugin"|"disable-plugin")
- compadd "$@" -- $(ls -1 "$AXZSH"/plugins)
+ compadd "$@" -- \
+ $(ls -1 "$AXZSH"/plugins) \
+ $(ls -1 "$AXZSH"/custom_plugins)
;;
"set-theme")
- compadd "$@" -- "-" $(ls -1 "$AXZSH"/themes | cut -d'.' -f1)
+ compadd "$@" -- "-" \
+ $(ls -1 "$AXZSH"/themes | cut -d'.' -f1) \
+ $(find "$AXZSH/custom_plugins" "$AXZSH/repos" -maxdepth 2 -iname '*.zsh-theme' -exec basename {} \; | cut -d'.' -f1)
;;
esac
;;