summaryrefslogtreecommitdiff
path: root/fnl/util.fnl
blob: 97a3cdc439d75471c47ef1d591728cea2ec2d366 (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
;; Utility functions.
(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)))

(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))))