diff options
author | Gustaf Rydholm <gustaf@nexure.io> | 2022-05-31 21:58:43 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf@nexure.io> | 2022-05-31 21:58:43 +0200 |
commit | 9d193be266500f7f69b78fbd80f99e87c87a52fc (patch) | |
tree | 11753e911f0bc980cdc5a72514fa17b68c9b08bd | |
parent | 87391bb447bd27a7c9c2c0c19c4a55babe18b22f (diff) |
Add sync when installed plugins does neq configured plugins
-rw-r--r-- | fnl/util.fnl | 10 |
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] |