From f19bf41c63b4e5484b82eb243ea8325d7ae126ba Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Sat, 21 Apr 2018 17:21:00 +0100 Subject: [PATCH] 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. --- zshrc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zshrc b/zshrc index abf5786..357e130 100644 --- a/zshrc +++ b/zshrc @@ -2,10 +2,14 @@ # executing commands, will be sourced when starting as an interactive shell. # Load plugin scripts -plugin-load() { source ~/.config/zsh/$1/$1.plugin.zsh } -plugin-load zsh-autosuggestions -plugin-load zsh-history-substring-search -plugin-load zsh-syntax-highlighting +source-plugin() { + [ -d ~/.config/zsh/$1 ] && \ + source ~/.config/zsh/$1/$1.plugin.zsh || \ + 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 ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(end-of-line vi-end-of-line)