summaryrefslogtreecommitdiff
path: root/fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf@nexure.io>2022-06-01 18:16:46 +0200
committerGustaf Rydholm <gustaf@nexure.io>2022-06-01 18:16:46 +0200
commit778f0d4fc6157a960f0efe90bc6dc535794efb1c (patch)
tree8635bec97164225c081b8d43f0f2a248fbaf8b9b /fnl
parentf4154f0cbe4479ef9c3425b0a25b1bcbeb32d16b (diff)
Update utils
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)]