summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraktersnurra <grydholm@kth.se>2022-04-30 18:06:40 +0200
committeraktersnurra <grydholm@kth.se>2022-04-30 18:06:40 +0200
commit86cfff221bd1d70d1b8e6860b3078b159b995c18 (patch)
treed389e8587c6d8fd3485b8872e9fdbe83fdfad5f9
parent04a2de0ea4f54ea38b7d24f35eaebded352e33a5 (diff)
refactor(install): mv install to util module
-rw-r--r--fnl/init.fnl9
-rw-r--r--fnl/install.fnl18
-rw-r--r--fnl/util.fnl15
3 files changed, 19 insertions, 23 deletions
diff --git a/fnl/init.fnl b/fnl/init.fnl
index 498a030..2255db4 100644
--- a/fnl/init.fnl
+++ b/fnl/init.fnl
@@ -1,8 +1,9 @@
;; Install, load settings, and load plugin configs.
(module init
- {autoload {util util}})
+ {autoload {util util}
+ require [settings
+ config.packer]})
-(require :settings)
-(require :config.packer)
-(require :install)
+(util.install)
+(util.sync)
(util.load-config)
diff --git a/fnl/install.fnl b/fnl/install.fnl
deleted file mode 100644
index 6f37ae8..0000000
--- a/fnl/install.fnl
+++ /dev/null
@@ -1,18 +0,0 @@
-;; Installs plugins with packer.
-(module install
- {autoload {a aniseed.core
- packer packer
- plugins plugins
- util util}})
-
-(defn- sync []
- (if (= util.num-plugins 3)
- (packer.sync)))
-
-(defn- install []
- (packer.startup (fn [use]
- (each [plugin opts (pairs plugins.plugins)]
- (use (a.assoc opts 1 plugin))))))
-
-(install)
-(sync)
diff --git a/fnl/util.fnl b/fnl/util.fnl
index 7222ebb..c624f64 100644
--- a/fnl/util.fnl
+++ b/fnl/util.fnl
@@ -1,10 +1,23 @@
;; Utility functions.
-(module util {autoload {nvim aniseed.nvim}})
+(module util
+ {autoload {a aniseed.core
+ nvim aniseed.nvim
+ packer packer
+ plugins plugins}})
(def- path (.. (vim.fn.stdpath :data) :/site/pack/packer/start))
(def num-plugins (length (vim.fn.readdir path)))
+(defn sync []
+ (if (= num-plugins 3)
+ (packer.sync)))
+
+(defn install []
+ (packer.startup (fn [use]
+ (each [plugin opts (pairs plugins.plugins)]
+ (use (a.assoc opts 1 plugin))))))
+
(defn load-config []
(if (> num-plugins 3)
(require :config)))