From 98a86e6b703f500de4e204e8545f9c3f5f23b4f8 Mon Sep 17 00:00:00 2001 From: crater2150 Date: Mon, 8 Jul 2019 16:11:28 +0200 Subject: [PATCH] Add helper function for sourcing files if present --- zshrc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zshrc b/zshrc index d8b00e9..71e04da 100644 --- a/zshrc +++ b/zshrc @@ -24,11 +24,16 @@ zdotfile() { echo /etc/zsh/$1 fi } +try-source() { + for i in "$@"; do + if [[ -e "$i" ]]; then + source $i + fi + done +} local dirfile=$(zdotfile dirs) -if [[ -e $dirfile ]]; then - source $dirfile -fi +try-source $dirfile . $(zdotfile completion.zsh) source $(zdotfile zplug.zsh)