From 93efc97f149a55cd1003d38d3f387442f935469b Mon Sep 17 00:00:00 2001 From: dmitmel Date: Fri, 15 Jun 2018 16:50:24 +0300 Subject: [PATCH] add lazy-loading of setup scripts for commands that aren't used very often --- functions.zsh | 14 ++++++++++++++ zshrc | 9 +++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/functions.zsh b/functions.zsh index 4ca0833..f05ecf7 100644 --- a/functions.zsh +++ b/functions.zsh @@ -15,3 +15,17 @@ command_exists() { source_if_exists() { [[ -f $1 ]] && source "$1" } + +run_before() { + local command="$1" + local init_command="$2" + + eval "$(cat <