Improve & rename plugin sourcing function

Rename `plugin-load` to `source-plugin` and add a check for the plugin
directory, a message is displayed if it does not exist.
This commit is contained in:
Kenneth Benzie 2018-04-21 17:21:00 +01:00
parent 9e77e83d7f
commit f19bf41c63

12
zshrc
View File

@ -2,10 +2,14 @@
# executing commands, will be sourced when starting as an interactive shell. # executing commands, will be sourced when starting as an interactive shell.
# Load plugin scripts # Load plugin scripts
plugin-load() { source ~/.config/zsh/$1/$1.plugin.zsh } source-plugin() {
plugin-load zsh-autosuggestions [ -d ~/.config/zsh/$1 ] && \
plugin-load zsh-history-substring-search source ~/.config/zsh/$1/$1.plugin.zsh || \
plugin-load zsh-syntax-highlighting echo "zsh plugin not found: $1"
}
source-plugin zsh-autosuggestions
source-plugin zsh-history-substring-search
source-plugin zsh-syntax-highlighting
# Disable non end-of-line autosuggest accept widgets # Disable non end-of-line autosuggest accept widgets
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(end-of-line vi-end-of-line) ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(end-of-line vi-end-of-line)