diff options
author | Gustaf Rydholm <gustaf@nexure.io> | 2022-06-01 18:16:46 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf@nexure.io> | 2022-06-01 18:16:46 +0200 |
commit | 778f0d4fc6157a960f0efe90bc6dc535794efb1c (patch) | |
tree | 8635bec97164225c081b8d43f0f2a248fbaf8b9b /fnl | |
parent | f4154f0cbe4479ef9c3425b0a25b1bcbeb32d16b (diff) |
Update utils
Diffstat (limited to 'fnl')
-rw-r--r-- | fnl/util.fnl | 13 |
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)] |