From 8689c11dd0d14d8456a09e43291badeb19bb508e Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 1 Feb 2025 02:35:39 -0800 Subject: [PATCH] feat: generate plugins/init.lua using fnl --- .nfnl.fnl | 2 +- fnl/plugins/init.fnl | 3 +++ lua/plugins/init.lua | 7 +++---- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 fnl/plugins/init.fnl diff --git a/.nfnl.fnl b/.nfnl.fnl index fdc1458..6caf408 100644 --- a/.nfnl.fnl +++ b/.nfnl.fnl @@ -24,7 +24,7 @@ ;; autocmd, so it'll only apply to buffers you're interested in. ;; Will use backslashes on Windows. ;; Defaults to compiling all .fnl files, you may want to limit it to your fnl/ directory. - :source-file-patterns [:./fnl/.*.fnl :./fnl/*.fnl :./fnl/**/*.fnl :init.fnl] + :source-file-patterns [:./fnl/.*.fnl :./fnl/*.fnl :./fnl/**/*.fnl :./init.fnl] ;; A function that is given the absolute path of a Fennel file and should return ;; the equivalent Lua path, by default this will translate `fnl/foo/bar.fnl` to `lua/foo/bar.lua`. ;; See the "Writing Lua elsewhere" tip below for an example function that writes to a sub directory. diff --git a/fnl/plugins/init.fnl b/fnl/plugins/init.fnl new file mode 100644 index 0000000..be4d692 --- /dev/null +++ b/fnl/plugins/init.fnl @@ -0,0 +1,3 @@ +(vim.loader.enable) +(let [plugins (require :plugins.lz-spec)] + ((. (require :lz.n) :load) plugins)) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index c78e7cb..fe4cabc 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,5 +1,4 @@ --- Experimental Neovim byte-compiled module loader +-- [nfnl] Compiled from ./fnl/plugins/init.fnl by https://github.com/Olical/nfnl, do not edit. vim.loader.enable() - -local pluginSpec = require("plugins.lz-spec") -require("lz.n").load(pluginSpec) +local plugins = require("plugins.lz-spec") +return require("lz.n").load(plugins)