dotfiles/mzte-nv/conf/lua/plugins.fnl

64 lines
1.9 KiB
Text
Raw Normal View History

2024-04-14 16:09:11 +02:00
(local mztenv (require :mzte_nv))
(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 "/*"))
(vim.opt.runtimepath:append (.. path :/*/after))))
2024-04-14 16:09:11 +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
:cmp
:luasnip
:nullls
2024-04-26 16:06:58 +02:00
:lspprogress
: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])
(local errors {})
(fn load-plugin [plugin]
(let [(success ret) (pcall require (.. :pluginconf/p- plugin))]
(when (not success)
(tset errors plugin ret))))
(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)]
(.. text " - " plugin ": " err "\n"))
vim.log.levels.error))
(each [_ cb (ipairs mztenv.reg.plugin_load_callbacks)]
(pcall cb))))))
(vim.schedule #(load-one-deferred 1))