From 99a3c0d31445fbd1139009848e402e982accf22b Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 10 Jan 2023 15:37:45 +0100 Subject: [PATCH] sh: Add conditionals to plugin loading --- office/.config/sh/alias.d/taskwarrior.sh | 2 +- terminal/.config/zsh/.zshrc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/office/.config/sh/alias.d/taskwarrior.sh b/office/.config/sh/alias.d/taskwarrior.sh index 45cb0ae..96ac796 100644 --- a/office/.config/sh/alias.d/taskwarrior.sh +++ b/office/.config/sh/alias.d/taskwarrior.sh @@ -14,7 +14,7 @@ t() { # copy the `task` zsh completions over to my little alias 😉 # this is not very pretty and not super portable (needs ps) but # works for now. from here: https://unix.stackexchange.com/a/72564/414758 -if [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi +if exist task && [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi # Make taskopen XDG conforming. If changing here, also change in taskrc alias. alias taskopen='taskopen --config=${XDG_CONFIG_HOME:-~/.config}/task/taskopenrc' diff --git a/terminal/.config/zsh/.zshrc b/terminal/.config/zsh/.zshrc index e92d653..d403f19 100644 --- a/terminal/.config/zsh/.zshrc +++ b/terminal/.config/zsh/.zshrc @@ -18,12 +18,12 @@ compinit # End of lines added by compinstall # load plugins -PLUG_FOLDER="/usr/share/zsh/plugins" -source /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh -source /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh -source /usr/share/fzf/key-bindings.zsh +[ -e /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh ] && source /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh +[ -e /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh ] && source /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh +[ -e /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh #source /usr/share/nvm/init-nvm.sh ## find the correct installed tab-completion version +PLUG_FOLDER="/usr/share/zsh/plugins" [ -e $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh ] && source $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh [ -e $PLUG_FOLDER/fzf-tab-bin-git/fzf-tab.plugin.zsh ] && source $PLUG_FOLDER/fzf-tab-bin-git/fzf-tab.plugin.zsh # these need to be sourced after fzf-tab