summaryrefslogtreecommitdiff
path: root/fnl
diff options
context:
space:
mode:
Diffstat (limited to 'fnl')
-rw-r--r--fnl/util.fnl13
1 files 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)]