mirror of
https://github.com/stevenproctor/dotfiles.git
synced 2026-01-28 08:39:56 -06:00
nvim - add table macro
This commit is contained in:
14
nvim/.config/nvim/fnl/config/macros.fnl
Normal file
14
nvim/.config/nvim/fnl/config/macros.fnl
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
;; [nfnl-macro]
|
||||||
|
|
||||||
|
(fn tx [& args]
|
||||||
|
"Mixed sequential and associative tables at compile time. Because the Neovim ecosystem loves them but Fennel has no neat way to express them (which I think is fine, I don't like the idea of them in general)."
|
||||||
|
(let [to-merge (when (table? (. args (length args)))
|
||||||
|
(table.remove args))]
|
||||||
|
(if to-merge
|
||||||
|
(do
|
||||||
|
(each [key value (pairs to-merge)]
|
||||||
|
(tset args key value))
|
||||||
|
args)
|
||||||
|
args)))
|
||||||
|
|
||||||
|
{: tx}
|
||||||
Reference in New Issue
Block a user