From 778f0d4fc6157a960f0efe90bc6dc535794efb1c Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 1 Jun 2022 18:16:46 +0200 Subject: Update utils --- fnl/util.fnl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fnl/util.fnl b/fnl/util.fnl index 9d51f74..a27d0bf 100644 --- a/fnl/util.fnl +++ b/fnl/util.fnl @@ -8,11 +8,11 @@ (def- path (.. (vim.fn.stdpath :data) :/site/pack/packer/start)) -(def- num-installed-plugins (length (vim.fn.readdir path))) +(defn- num-installed-plugins [] (length (vim.fn.readdir path))) -(defn sync [] (if (or (= num-installed-plugins 3) - (not= num-installed-plugins num-plugins)) - (packer.sync))) +(defn sync [] (let [num-installed-plugins (num-installed-plugins)] + (if (not= num-installed-plugins num-plugins) + (packer.sync)))) (defn install [] (packer.startup (fn [use] @@ -20,8 +20,9 @@ (set num-plugins (+ num-plugins 1)) (use (a.assoc opts 1 plugin)))))) -(defn load-config [] (if (= num-installed-plugins num-plugins) - (require :config))) +(defn load-config [] (let [num-installed-plugins (num-installed-plugins)] + (if (= num-installed-plugins num-plugins) + (require :config)))) (defn load-plugin [name] (let [(ok? val-or-err) (pcall require name)] -- cgit v1.2.3-70-g09d2