blob: 0e9039642c81367874d4631bd81b8aa2821fc481 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
;; Utility functions.
(module util {autoload {a aniseed.core nvim aniseed.nvim : packer}})
(def- plugins (require :plugins))
(def- path (.. (vim.fn.stdpath :data) :/site/pack/packer/start))
(defn- num-plugins [] (var i 0)
(each [_ _ (pairs plugins)]
(set i (+ i 1))) i)
(defn- num-installed-plugins [] (length (vim.fn.readdir path)))
(defn- install []
(packer.startup (fn [use]
(each [plugin opts (pairs plugins)]
(use (a.assoc opts 1 plugin))))))
(defn load-plugins [] (install)
(let [num-installed-plugins (num-installed-plugins)
num-plugins (num-plugins)]
(if (not= num-installed-plugins num-plugins)
(packer.sync))) (require :config))
(defn load-plugin [name]
(let [(ok? val-or-err) (pcall require name)]
(if ok?
val-or-err
(vim.notify (.. "Could not load config: " val-or-err)
vim.log.levels.WARN))))
|