diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-07-29 00:52:43 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-07-29 00:52:43 +0200 |
commit | acdd91aca61e5d8b8653cd90cbfbee01f6fb6fca (patch) | |
tree | 747b31a607cbfbaafb3703bf2ea3794aeb7402d6 | |
parent | f048e7a0042c10885ee37301464febc8c8f63e96 (diff) |
Refactor
-rw-r--r-- | fnl/aktersnurra.fnl | 10 | ||||
-rw-r--r-- | fnl/plugins/snippets.fnl | 4 | ||||
-rw-r--r-- | 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 :<leader>y "<cmd>Lazy home<cr>" {: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] :<c-u> 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} |