From acdd91aca61e5d8b8653cd90cbfbee01f6fb6fca Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Mon, 29 Jul 2024 00:52:43 +0200 Subject: Refactor --- fnl/aktersnurra.fnl | 10 ++++------ fnl/plugins/snippets.fnl | 4 ++-- fnl/util/load.fnl | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/fnl/aktersnurra.fnl b/fnl/aktersnurra.fnl index e72661a..cf50b2f 100644 --- a/fnl/aktersnurra.fnl +++ b/fnl/aktersnurra.fnl @@ -5,11 +5,7 @@ (local icons (require :settings.icons)) -(local {: load-and-apply} (require :util.load)) - -(local plugins (let [tbl {}] - (load-and-apply :/fnl/plugins (partial load-plugin tbl)) - tbl)) +(local {: apply-to-files} (require :util.load)) (local opts {:install {:colorscheme [:no-clown-fiesta]} :debug false @@ -47,7 +43,9 @@ (λ init [] (require :settings) - (let [lazy (require :lazy)] + (let [lazy (require :lazy) + plugins {}] + (apply-to-files :/fnl/plugins (partial load-plugin plugins)) (vim.keymap.set :n :y "Lazy home" {:desc :Home}) (lazy.setup plugins opts))) diff --git a/fnl/plugins/snippets.fnl b/fnl/plugins/snippets.fnl index 569af44..44c8a2d 100644 --- a/fnl/plugins/snippets.fnl +++ b/fnl/plugins/snippets.fnl @@ -6,13 +6,13 @@ (let [snippets (require (.. :plugins.snippets. name))] (snippets.add-snippets))) -(local {: load-and-apply} (require :util.load)) +(local {: apply-to-files} (require :util.load)) (λ config [] (let [ls (require :luasnip) luasnip-vscode (require :luasnip.loaders.from_vscode)] (luasnip-vscode.lazy_load) - (load-and-apply :/fnl/plugins/snippets add-snippets) + (apply-to-files :/fnl/plugins/snippets add-snippets) (ls.config.set_config {:history false :updateevents "TextChanged,TextChangedI"}) (vim.keymap.set [:i :s] : diff --git a/fnl/util/load.fnl b/fnl/util/load.fnl index fef9b6e..afc6cf1 100644 --- a/fnl/util/load.fnl +++ b/fnl/util/load.fnl @@ -1,8 +1,8 @@ ;; Load file with function -(λ load-and-apply [path f] +(λ apply-to-files [path f] (each [fname type (vim.fs.dir (.. (vim.fn.stdpath :config) path))] (when (= type :file) (f (fname:match "^(.*)%.fnl$"))))) -{: load-and-apply} +{: apply-to-files} -- cgit v1.2.3-70-g09d2