2024-04-14 16:09:11 +02:00
|
|
|
(local mztenv (require :mzte_nv))
|
|
|
|
|
2024-04-14 16:55:23 +02:00
|
|
|
(tset mztenv.reg :plugin_load_callbacks [])
|
|
|
|
|
2024-04-14 16:09:11 +02:00
|
|
|
(let [path mztenv.reg.nvim_plugins]
|
|
|
|
(when path
|
2024-04-14 18:33:55 +02:00
|
|
|
(vim.opt.runtimepath:prepend (.. path "/*"))
|
2024-04-28 19:57:19 +02:00
|
|
|
(vim.opt.runtimepath:append (.. path :/*/after))))
|
2024-04-14 16:09:11 +02:00
|
|
|
|
2024-04-14 16:55:23 +02:00
|
|
|
;; Plugins to load before nvim finishes startup
|
|
|
|
(local startup-plugins [])
|
|
|
|
|
|
|
|
;; Plugins to load in the background
|
2024-04-28 21:58:28 +02:00
|
|
|
(local deferred-plugins [:catppuccin
|
|
|
|
:lspconf
|
|
|
|
:lsp-saga
|
2024-04-14 16:55:23 +02:00
|
|
|
:cmp
|
|
|
|
:luasnip
|
|
|
|
:nullls
|
2024-04-26 16:06:58 +02:00
|
|
|
:lspprogress
|
2024-04-14 16:55:23 +02:00
|
|
|
:line
|
|
|
|
:treesitter
|
|
|
|
:nvimtree
|
|
|
|
:devicons
|
|
|
|
:neogit
|
|
|
|
:telescope
|
|
|
|
:autopairs
|
|
|
|
:tterm
|
|
|
|
:ts-context
|
|
|
|
:ufo
|
|
|
|
:dap
|
|
|
|
:harpoon
|
|
|
|
:recorder
|
|
|
|
:tsn-actions
|
2024-04-21 20:57:10 +02:00
|
|
|
:dressing
|
2024-05-09 14:55:59 +02:00
|
|
|
:gitsigns
|
|
|
|
:nu])
|
2024-04-14 16:55:23 +02:00
|
|
|
|
|
|
|
(local errors {})
|
|
|
|
|
|
|
|
(fn load-plugin [plugin]
|
|
|
|
(let [(success ret) (pcall require (.. :pluginconf/p- plugin))]
|
|
|
|
(when (not success)
|
2024-04-28 19:57:19 +02:00
|
|
|
(tset errors plugin ret))))
|
2024-04-14 16:55:23 +02:00
|
|
|
|
|
|
|
(each [_ p (ipairs startup-plugins)]
|
|
|
|
(load-plugin p))
|
|
|
|
|
|
|
|
(fn load-one-deferred [idx]
|
|
|
|
(let [plugin (. deferred-plugins idx)]
|
|
|
|
(if plugin
|
|
|
|
(do
|
|
|
|
(load-plugin plugin)
|
|
|
|
(vim.schedule #(load-one-deferred (+ idx 1))))
|
|
|
|
(do
|
|
|
|
(when (next errors)
|
|
|
|
(vim.notify (accumulate [text "Errors loading plugin configs:\n" plugin err (pairs errors)]
|
2024-04-28 19:57:19 +02:00
|
|
|
(.. text " - " plugin ": " err "\n"))
|
2024-04-14 16:55:23 +02:00
|
|
|
vim.log.levels.error))
|
|
|
|
(each [_ cb (ipairs mztenv.reg.plugin_load_callbacks)]
|
|
|
|
(pcall cb))))))
|
|
|
|
|
|
|
|
(vim.schedule #(load-one-deferred 1))
|