summaryrefslogtreecommitdiff
path: root/fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-11 23:56:08 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-11 23:56:08 +0200
commitd135c0f65a7f0703dd3428e8629396f4e2710ec7 (patch)
tree7b791307b1c5e75d04b0eb372c4abd118d2c5b57 /fnl
parent95944c1bde19418e9b8aa1c91622067945c7b1ea (diff)
fix(load config): pre compute num plugins
Diffstat (limited to 'fnl')
-rw-r--r--fnl/init.fnl4
-rw-r--r--fnl/install.fnl6
-rw-r--r--fnl/util.fnl3
3 files changed, 7 insertions, 6 deletions
diff --git a/fnl/init.fnl b/fnl/init.fnl
index 567214f..4862b16 100644
--- a/fnl/init.fnl
+++ b/fnl/init.fnl
@@ -1,6 +1,6 @@
;; Install, load settings, and load plugin configs.
-(module init)
+(module init {autoload {util util}})
(require :settings)
(require :install)
-(if (> (length (vim.fn.readdir path)) 3)
+(if (> util.num-plugins 3)
(require :config))
diff --git a/fnl/install.fnl b/fnl/install.fnl
index f6b4501..50fbe24 100644
--- a/fnl/install.fnl
+++ b/fnl/install.fnl
@@ -2,7 +2,8 @@
(module install {autoload {a aniseed.core
plugins plugins
packer packer
- bootstrap bootstrap}})
+ bootstrap bootstrap
+ util util}})
(defn- install-plugins [plgs]
(packer.startup (fn [use]
@@ -10,6 +11,5 @@
(use (a.assoc opts 1 plugin))))))
(install-plugins plugins.plugins)
-(local path (.. (vim.fn.stdpath :data) :/site/pack/packer/start))
-(if (= (length (vim.fn.readdir path)) 3)
+(if (= util.num-plugins 3)
(packer.sync))
diff --git a/fnl/util.fnl b/fnl/util.fnl
index e6b4d9f..8bb3754 100644
--- a/fnl/util.fnl
+++ b/fnl/util.fnl
@@ -1,7 +1,8 @@
;; Utility functions.
(module util {autoload {nvim aniseed.nvim}})
-(defn autocmd [name opts] (nvim.ex.create_autocmd name opts))
+(def- path (.. (vim.fn.stdpath :data) :/site/pack/packer/start))
+(def num-plugins (length (vim.fn.readdir path)))
(defn load-plugin [name]
(let [(ok? val-or-err) (pcall require name)]