diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-15 22:47:30 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-15 22:47:30 +0100 |
commit | 10b175f252104458d7478d8a2822818850cfdf92 (patch) | |
tree | ee926d33bee6b4acfe45fce0dd8aa9e94f03f06a /fnl/plugins/init.fnl | |
parent | 9d4f654187869f96e27ab54a88708aba5959f1ba (diff) |
Refactor file structure
Diffstat (limited to 'fnl/plugins/init.fnl')
-rw-r--r-- | fnl/plugins/init.fnl | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/fnl/plugins/init.fnl b/fnl/plugins/init.fnl index 6b0bde8..00be90b 100644 --- a/fnl/plugins/init.fnl +++ b/fnl/plugins/init.fnl @@ -1,16 +1,21 @@ ;; Load all plugins. -(local plugins (let [plugins (require :plugins.lsp) - path (.. (vim.fn.stdpath :config) :/fnl/plugins)] - (if (vim.loop.fs_stat path) - (do - (each [fname (vim.fs.dir path)] - (let [fname (fname:match "^(.*)%.fnl$")] - (if (and (not= fname nil) (not= fname :init) - (not= fname :lazy)) - (table.insert plugins - (require (.. :plugins. fname)))))))) - plugins)) +(fn get-plugins [...] + (let [plugins [] + path (.. (vim.fn.stdpath :config) :/fnl/plugins)] + (each [_ m (ipairs [...])] + (let [module-path (.. path "/" m)] + (if (vim.loop.fs_stat module-path) + (do + (if (= :lsp m) + (table.insert plugins (require (.. :plugins. m))) + (each [fname (vim.fs.dir module-path)] + (let [fname (fname:match "^(.*)%.fnl$")] + (table.insert plugins + (require (.. :plugins. m "." fname)))))))))) + (vim.tbl_flatten plugins) + plugins)) -(let [lazy (require :plugins.lazy)] +(let [lazy (require :plugins.core.lazy) + plugins (get-plugins :compiler :editor :lsp :tools :ui)] (lazy.setup plugins)) |