nvim: Lazy load most mini.nvim modules
Except for mini.starter which we need right at the - well - start, we can lazy load most other modules. It's a little awkward since we lazy load them *within* the setup function with a manual autocommand but it should work fine for the time being.
This commit is contained in:
parent
b2e0621d12
commit
86dfc5ecbc
1 changed files with 65 additions and 59 deletions
|
@ -92,8 +92,8 @@ return {
|
|||
-- collection of plugins
|
||||
{
|
||||
"echasnovski/mini.nvim",
|
||||
version = "*",
|
||||
dependencies = { "rktjmp/fwatch.nvim" },
|
||||
dependencies = { "rktjmp/fwatch.nvim" }, -- for colorscheme updating
|
||||
event = "VimEnter", -- need to load pretty soon for Starter screen
|
||||
config = function()
|
||||
-- automatic callback to invoke 'mini.base16' when colorscheme file is changed
|
||||
local colorsfile = vim.fn.stdpath("state") .. "/colorscheme.lua"
|
||||
|
@ -112,6 +112,33 @@ return {
|
|||
end),
|
||||
})
|
||||
|
||||
-- this should be loaded as soon as the plugin is loaded
|
||||
local starter = require("mini.starter")
|
||||
starter.setup({
|
||||
evaluate_single = true,
|
||||
items = {
|
||||
starter.sections.builtin_actions(),
|
||||
{
|
||||
name = "Scratchpad",
|
||||
action = "lua require('personal.scratchpad').create()",
|
||||
section = "Builtin actions",
|
||||
},
|
||||
starter.sections.recent_files(10, true),
|
||||
starter.sections.recent_files(10, false),
|
||||
-- Use this if you set up 'mini.sessions'
|
||||
-- starter.sections.sessions(),
|
||||
starter.sections.telescope(),
|
||||
},
|
||||
content_hooks = {
|
||||
starter.gen_hook.adding_bullet(),
|
||||
starter.gen_hook.padding(3, 2),
|
||||
starter.gen_hook.aligning("center", "center"),
|
||||
},
|
||||
})
|
||||
-- manually create lazy loading scenarios
|
||||
vim.api.nvim_create_autocmd({ "InsertEnter", "CursorHold" }, {
|
||||
once = true,
|
||||
callback = function()
|
||||
require("mini.ai").setup()
|
||||
-- Align tables and other alignable things
|
||||
require("mini.align").setup({})
|
||||
|
@ -126,7 +153,7 @@ return {
|
|||
indent = { suffix = "" }, -- disable since we use indentscope above
|
||||
jump = { suffix = "j", options = {} },
|
||||
location = { suffix = "l", options = {} },
|
||||
oldfile = { suffix = "o", options = {} },
|
||||
oldfile = { suffix = "o", options = {} }, -- FIXME: overwritten by wrapping defaults currently
|
||||
quickfix = { suffix = "q", options = {} },
|
||||
treesitter = { suffix = "t", options = {} },
|
||||
undo = { suffix = "" }, -- disable since I don't need it
|
||||
|
@ -168,30 +195,9 @@ return {
|
|||
require("mini.operators").setup()
|
||||
require("mini.pairs").setup()
|
||||
require("mini.trailspace").setup()
|
||||
local starter = require("mini.starter")
|
||||
starter.setup({
|
||||
evaluate_single = true,
|
||||
items = {
|
||||
starter.sections.builtin_actions(),
|
||||
{
|
||||
name = "Scratchpad",
|
||||
action = "lua require('personal.scratchpad').create()",
|
||||
section = "Builtin actions",
|
||||
},
|
||||
starter.sections.recent_files(10, true),
|
||||
starter.sections.recent_files(10, false),
|
||||
-- Use this if you set up 'mini.sessions'
|
||||
-- starter.sections.sessions(),
|
||||
starter.sections.telescope(),
|
||||
},
|
||||
content_hooks = {
|
||||
starter.gen_hook.adding_bullet(),
|
||||
starter.gen_hook.padding(3, 2),
|
||||
starter.gen_hook.aligning("center", "center"),
|
||||
},
|
||||
end,
|
||||
})
|
||||
end,
|
||||
event = "VimEnter", -- need to load pretty soon for Starter screen
|
||||
keys = {
|
||||
{
|
||||
"<leader>sm",
|
||||
|
|
Loading…
Reference in a new issue