From 9d193be266500f7f69b78fbd80f99e87c87a52fc Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 31 May 2022 21:58:43 +0200 Subject: Add sync when installed plugins does neq configured plugins --- fnl/util.fnl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'fnl') 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] -- cgit v1.2.3-70-g09d2