diff options
-rw-r--r-- | fnl/init.fnl | 8 | ||||
-rw-r--r-- | fnl/install.fnl | 23 | ||||
-rw-r--r-- | fnl/util.fnl | 5 |
3 files changed, 23 insertions, 13 deletions
diff --git a/fnl/init.fnl b/fnl/init.fnl index 42e20d5..498a030 100644 --- a/fnl/init.fnl +++ b/fnl/init.fnl @@ -1,6 +1,8 @@ ;; Install, load settings, and load plugin configs. -(module init {autoload {util util}}) +(module init + {autoload {util util}}) + (require :settings) +(require :config.packer) (require :install) -(if (> util.num-plugins 3) - (require :config)) +(util.load-config) diff --git a/fnl/install.fnl b/fnl/install.fnl index af034d6..6f37ae8 100644 --- a/fnl/install.fnl +++ b/fnl/install.fnl @@ -1,15 +1,18 @@ ;; Installs plugins with packer. -(module install {autoload {a aniseed.core - packer packer - plugins plugins - util util}}) +(module install + {autoload {a aniseed.core + packer packer + plugins plugins + util util}}) -(defn- install-plugins [plgs] +(defn- sync [] + (if (= util.num-plugins 3) + (packer.sync))) + +(defn- install [] (packer.startup (fn [use] - (each [plugin opts (pairs plgs)] + (each [plugin opts (pairs plugins.plugins)] (use (a.assoc opts 1 plugin)))))) -(require :config.packer) -(install-plugins plugins.plugins) -(if (= util.num-plugins 3) - (packer.sync)) +(install) +(sync) diff --git a/fnl/util.fnl b/fnl/util.fnl index 9054f54..7222ebb 100644 --- a/fnl/util.fnl +++ b/fnl/util.fnl @@ -2,8 +2,13 @@ (module util {autoload {nvim aniseed.nvim}}) (def- path (.. (vim.fn.stdpath :data) :/site/pack/packer/start)) + (def num-plugins (length (vim.fn.readdir path))) +(defn load-config [] + (if (> num-plugins 3) + (require :config))) + (defn load-plugin [name] (let [(ok? val-or-err) (pcall require name)] (if ok? |