summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fnl/util.fnl10
1 files changed, 7 insertions, 3 deletions
diff --git a/fnl/util.fnl b/fnl/util.fnl
index 97a3cdc..9d51f74 100644
--- a/fnl/util.fnl
+++ b/fnl/util.fnl
@@ -4,19 +4,23 @@
packer packer
plugins plugins}})
+(var num-plugins 0)
+
(def- path (.. (vim.fn.stdpath :data) :/site/pack/packer/start))
-(def num-plugins (length (vim.fn.readdir path)))
+(def- num-installed-plugins (length (vim.fn.readdir path)))
-(defn sync [] (if (= num-plugins 3)
+(defn sync [] (if (or (= num-installed-plugins 3)
+ (not= num-installed-plugins num-plugins))
(packer.sync)))
(defn install []
(packer.startup (fn [use]
(each [plugin opts (pairs plugins.plugins)]
+ (set num-plugins (+ num-plugins 1))
(use (a.assoc opts 1 plugin))))))
-(defn load-config [] (if (> num-plugins 3)
+(defn load-config [] (if (= num-installed-plugins num-plugins)
(require :config)))
(defn load-plugin [name]