From a11fbf7516ec8ffa96814e0e60d0c5e6ccfd0c1a Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 23 Aug 2021 15:16:56 +0100 Subject: [PATCH] ZSH: checks for commands existance before running --- shells/zsh/STOW/.zshrc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/shells/zsh/STOW/.zshrc b/shells/zsh/STOW/.zshrc index cb0ab6ea..be87ce2f 100644 --- a/shells/zsh/STOW/.zshrc +++ b/shells/zsh/STOW/.zshrc @@ -46,7 +46,7 @@ preexec() { echo -ne '\e[5 q' ;} bindkey -v '^?' backward-delete-char -if [ ! -n "$SSH_CLIENT" ] && [ ! -n "$SSH_TTY" ]; then +if [ ! -n "$SSH_CLIENT" ] && [ ! -n "$SSH_TTY" ] && [ ! -n "$NO_COLOR" ]; then if [ -L $DOTFILES/shells/zsh/current-color-scheme ]; then source $DOTFILES/shells/zsh/current-color-scheme fi @@ -66,7 +66,7 @@ if [ -n "$initialCommand" ]; then echo "Running $initialCommand" ${=initialCommand} && exit else - local current="$(project current --path)" + local current="$(type -p project > /dev/null && project current --path)" if [ -n "$current" ]; then local script="/usr/bin/script" if [[ ! "$(ps -ocommand -p $PPID | grep -v 'COMMAND' | cut -d' ' -f1 )" == "$script" ]]; then @@ -74,7 +74,8 @@ else /usr/bin/script -f "$current/shell-logs/$(date +"%d-%b-%y_%H-%M-%S")_shell.log" fi else - rem -@ + type -p rem > /dev/null && rem -@ + pkill rem fi fi @@ -86,5 +87,7 @@ done export PATH="$PATH:$ZSH_FOLDER/plugins/git-fuzzy/bin" -# Load zsh-syntax-highlighting; should be last. -source $HOME/.dotfiles/shells/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2> /dev/null +if [ -z "$NO_COLOR" ]; then + # Load zsh-syntax-highlighting; should be last. + source $HOME/.dotfiles/shells/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2> /dev/null +fi