From 5ace0bb7f402a034ec8292107debef8c31cc1cfd Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Sun, 23 Aug 2020 12:07:09 +0100 Subject: [PATCH] zsh: trysource various ZSH plugins These vary by OS/distribution and even between devices depending on what is installed. Most of these are optional anyway so make a best-effort attempt to load them. Signed-off-by: Joe Groocock --- zsh/.zshrc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index a592452..3e075ce 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -155,8 +155,12 @@ source "$XDG_CONFIG_HOME/aliases" source "$ZSH_DIR/plugins/sudo.zsh" source "$ZSH_DIR/plugins/fish-theme.zsh" source "$ZSH_DIR/plugins/git-rprompt.zsh" -[ -f '/usr/share/fzf/key-bindings.zsh' ] && source /usr/share/fzf/key-bindings.zsh -[ -f '/usr/share/doc/pkgfile/command-not-found.zsh' ] && source /usr/share/doc/pkgfile/command-not-found.zsh + +trysource() { [ -f "$1" ] && source "$1"; } +trysource /usr/share/fzf/key-bindings.zsh 2>&1 # Arch/sensible distros +trysource /usr/share/doc/fzf/examples/key-bindings.zsh 2>&1 # Debian, because Debian +trysource /usr/share/doc/pkgfile/command-not-found.zsh 2>&1 # pkgfile on Arch +trysource /usr/share/z/z.sh # Completion initialisation autoload -U compinit bashcompinit