aboutsummaryrefslogtreecommitdiff
path: root/fnl/nvrc/macro
diff options
context:
space:
mode:
Diffstat (limited to 'fnl/nvrc/macro')
-rw-r--r--fnl/nvrc/macro/pack.fnl43
1 files changed, 7 insertions, 36 deletions
diff --git a/fnl/nvrc/macro/pack.fnl b/fnl/nvrc/macro/pack.fnl
index 7f76a0d..074723e 100644
--- a/fnl/nvrc/macro/pack.fnl
+++ b/fnl/nvrc/macro/pack.fnl
@@ -7,16 +7,14 @@
(fn tbl? [x]
(= :table (type x)))
-(local {: format} string)
(local {: insert} table)
(global nvrc/pack [])
-(global nvrc/rock [])
(lambda pack [identifier ?options]
"Returns a mixed table with the identifier as the first sequential element
and options as hash-table items.
- See https://github.com/wbthomason/packer.nvim for information about the
+ See https://github.com/folke/lazy.nvim for information about the
options."
(assert-compile (str? identifier) "expected string for identifier" identifier)
(assert-compile (or (nil? ?options) (tbl? ?options))
@@ -24,8 +22,8 @@
(let [options (or ?options {})
options (collect [k v (pairs options)]
(if
- (= k :req) (values :config (format "require('nvrc.packs.%s')" v))
- (= k :init) (values :config (format "require('%s').setup({})" v))
+ (= k :req) (values :config `#(require (string.format "nvrc.packs.%s" ,v)))
+ (= k :init) (values :config `#((. (require ,v) :setup) {}))
(values k v)))]
(doto options
(tset 1 identifier))))
@@ -33,47 +31,20 @@
(lambda pack! [identifier ?options]
"Declares a plugin with its options.
This is a mixed table saved on the global compile-time variable nvrc/pack.
- See https://github.com/wbthomason/packer.nvim for information about the
+ See https://github.com/folke/lazy.nvim for information about the
options."
(assert-compile (str? identifier) "expected string for identifier" identifier)
(assert-compile (or (nil? ?options) (tbl? ?options))
"expected table for options" ?options)
(insert nvrc/pack (pack identifier ?options)))
-(lambda rock [identifier ?options]
- "Returns a mixed table with the identifier as the first sequential element
- and options as hash-table items.
- See https://github.com/wbthomason/packer.nvim for information about the
- options."
- (assert-compile (str? identifier) "expected string for identifier" identifier)
- (assert-compile (or (nil? ?options) (tbl? ?options))
- "expected table for options" ?options)
- (let [options (or ?options {})]
- (doto options
- (tset 1 identifier))))
-
-(lambda rock! [identifier ?options]
- "Declares a plugin with its options.
- This is a mixed table saved on the global compile-time variable nvrc/rock.
- See https://github.com/wbthomason/packer.nvim for information about the
- options."
- (assert-compile (str? identifier) "expected string for identifier" identifier)
- (assert-compile (or (nil? ?options) (tbl? ?options))
- "expected table for options" ?options)
- (insert nvrc/rock (rock identifier ?options)))
-
(lambda unpack! []
"Initializes the plugin manager with the previously declared plugins and
their options."
- (let [packs (icollect [_ v (ipairs nvrc/pack)]
- `(use ,v))
- rocks (icollect [_ v (ipairs nvrc/rock)]
- `(use_rocks ,v))]
- `((. (require :packer) :startup) #(do
- ,(unpack (icollect [_ v (ipairs packs) :into rocks] v))))))
+ (let [packs [(unpack (icollect [_ v (ipairs nvrc/pack)]
+ v))]]
+ `((. (require :lazy) :setup) ,packs)))
{: pack
: pack!
- : rock
- : rock!
: unpack!}