summaryrefslogtreecommitdiff
path: root/fnl/config/util.fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-10-16 01:40:16 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-10-16 01:40:16 +0200
commit6cb31718df762c6ebf764986074f08b19d6f82f8 (patch)
tree4bc60c9d94de082914ea9ab2d488114caff4edd4 /fnl/config/util.fnl
parent68c0f6bab06ea587b9b258d1ad3b0c9870bc163f (diff)
Refactor loading of plugins with packer
Diffstat (limited to 'fnl/config/util.fnl')
-rw-r--r--fnl/config/util.fnl13
1 files changed, 13 insertions, 0 deletions
diff --git a/fnl/config/util.fnl b/fnl/config/util.fnl
new file mode 100644
index 0000000..a4dcf5b
--- /dev/null
+++ b/fnl/config/util.fnl
@@ -0,0 +1,13 @@
+;; Utility functions.
+(module util {autoload {a aniseed.core nvim aniseed.nvim}})
+
+(defn prequire [name]
+ (let [(ok? plugin) (pcall require name)]
+ (if ok?
+ plugin
+ (vim.notify (.. "Could not load config: " plugin)
+ vim.log.levels.WARN))))
+
+(defn setup [plugin config]
+ (let [plugin (prequire plugin)]
+ (plugin.setup config)))