nvim: Split up mini plugins for lazier loading

Split off base16 (instant load for themes) and starter (only load on
empty start) from rest.
This commit is contained in:
Marty Oehme 2025-06-21 15:51:29 +02:00
parent 091274fd82
commit 020ec86481
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 140 additions and 125 deletions

View file

@ -45,7 +45,10 @@
"mason.nvim": { "branch": "main", "commit": "7f265cd6ae56cecdd0aa50c8c73fc593b0604801" },
"mcphub.nvim": { "branch": "main", "commit": "85a7a659fc82da1429a2241ab61e9ce07b3db374" },
"mdeval.nvim": { "branch": "master", "commit": "0e1b248db174a9659a9ab16eb8c90ff3aec55264" },
"mini.base16": { "branch": "main", "commit": "2eb2d2b889a8c861d1a66ec651bd0edb417d5c7f" },
"mini.files": { "branch": "main", "commit": "49c855977e9f4821d1ed8179ed44fe098b93ea2a" },
"mini.nvim": { "branch": "main", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" },
"mini.starter": { "branch": "main", "commit": "d8038690eadf203a40863c3a9423df880a901d39" },
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
"neo-tree-jj.nvim": { "branch": "main", "commit": "c6534930c6f79893e12eafbb722ee23e6a83e80e" },
"neo-tree.nvim": { "branch": "main", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" },
@ -75,7 +78,6 @@
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
"otter.nvim": { "branch": "main", "commit": "f3a401851c25c64220dcf2470252a1adc28308d5" },
"pantran.nvim": { "branch": "main", "commit": "b87c3ae48cba4659587fb75abd847e5b7a7c9ca0" },
"peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"quarto-nvim": { "branch": "main", "commit": "5325af3731ac9840b308791f08ad660958d76163" },

View file

@ -109,9 +109,9 @@ return {
},
-- collection of plugins
{
"echasnovski/mini.nvim",
"echasnovski/mini.base16",
dependencies = { "rktjmp/fwatch.nvim" }, -- for colorscheme updating
event = { "VeryLazy", "StartScreen" }, -- need to load pretty soon for Starter screen
event = "VimEnter",
config = function()
-- automatic callback to invoke 'mini.base16' when colorscheme file is changed
local colorsfile = vim.fn.stdpath("state") .. "/colorscheme.lua"
@ -129,8 +129,12 @@ return {
source_colors()
end),
})
-- this should be loaded as soon as the plugin is loaded
end,
},
{
"echasnovski/mini.starter",
event = "StartScreen",
config = function()
local starter = require("mini.starter")
starter.setup({
evaluate_single = true,
@ -153,6 +157,22 @@ return {
starter.gen_hook.aligning("center", "center"),
},
})
end,
keys = {
{
"<leader>ss",
function()
require("mini.starter").open()
end,
silent = true,
desc = "startpage",
},
},
},
{
"echasnovski/mini.files",
event = { "VeryLazy" },
config = function()
require("mini.files").setup({
mappings = {
synchronize = "S",
@ -169,115 +189,126 @@ return {
pattern = "MiniFilesWindowUpdate",
callback = function(args)
local win_id = args.data.win_id
vim.wo[win_id].number = true
end,
})
end,
keys = {
{
"<leader>e",
function()
local mf = require("mini.files")
if not mf.close() then
mf.open()
end
end,
desc = "floating file browser",
},
},
},
{
"echasnovski/mini.nvim",
event = { "InsertEnter", "VeryLazy" },
config = function()
-- manually create lazy loading scenarios
vim.api.nvim_create_autocmd({ "InsertEnter", "CursorHold" }, {
once = true,
require("mini.ai").setup()
-- Align tables and other alignable things
require("mini.align").setup({})
require("mini.bracketed").setup({
buffer = { suffix = "b", options = {} },
comment = { suffix = "k", options = {} },
conflict = { suffix = "" }, -- disable to use git-conflict instead
diagnostic = { suffix = "e", options = {} },
file = { suffix = "f", options = {} },
indent = { suffix = "" }, -- disable since we use indentscope
jump = { suffix = "j", options = {} },
location = { suffix = "l", options = {} },
oldfile = { suffix = "o", options = {} },
quickfix = { suffix = "q", options = {} },
treesitter = { suffix = "t", options = {} },
undo = { suffix = "" }, -- disable since I don't need it
window = { suffix = "w", options = {} },
yank = { suffix = "y", options = {} },
})
require("mini.comment").setup({
hooks = {
pre = function()
-- use treesitter commentstring functionality if it's installed
if require("core.util").is_available("ts_context_commentstring") then
require("ts_context_commentstring.internal").update_commentstring()
end
end,
},
})
require("mini.cursorword").setup({ delay = 500 })
vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true, underline = false })
vim.api.nvim_set_hl(0, "MiniCursorwordCurrent", { bold = true, underline = false })
require("mini.fuzzy").setup()
require("mini.indentscope").setup({
symbol = "",
draw = { animation = require("mini.indentscope").gen_animation.none() },
options = { indent_at_cursor = false, n_lines = 2000 },
})
-- disable indentlines for terminals
vim.api.nvim_create_autocmd("TermOpen", {
pattern = "*",
callback = function()
require("mini.ai").setup()
-- Align tables and other alignable things
require("mini.align").setup({})
require("mini.bracketed").setup({
buffer = { suffix = "b", options = {} },
comment = { suffix = "k", options = {} },
conflict = { suffix = "" }, -- disable to use git-conflict instead
diagnostic = { suffix = "e", options = {} },
file = { suffix = "f", options = {} },
indent = { suffix = "" }, -- disable since we use indentscope
jump = { suffix = "j", options = {} },
location = { suffix = "l", 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
window = { suffix = "w", options = {} },
yank = { suffix = "y", options = {} },
})
require("mini.comment").setup({
hooks = {
pre = function()
-- use treesitter commentstring functionality if it's installed
if require("core.util").is_available("ts_context_commentstring") then
require("ts_context_commentstring.internal").update_commentstring()
end
end,
},
})
require("mini.cursorword").setup({ delay = 500 })
vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true, underline = false })
vim.api.nvim_set_hl(0, "MiniCursorwordCurrent", { bold = true, underline = false })
require("mini.fuzzy").setup()
require("mini.indentscope").setup({
symbol = "",
draw = { animation = require("mini.indentscope").gen_animation.none() },
options = { indent_at_cursor = false, n_lines = 2000 },
})
-- disable indentlines for terminals
vim.api.nvim_create_autocmd("TermOpen", {
pattern = "*",
callback = function()
vim.b.miniindentscope_disable = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"lazy",
"mason",
"help",
"lspinfo",
"packer",
"checkhealth",
"man",
"gitcommit",
"TelescopePrompt",
"TelescopeResults",
"trouble",
},
callback = function()
vim.b.miniindentscope_disable = true
end,
})
require("mini.map").setup()
require("mini.move").setup()
require("mini.operators").setup()
require("mini.pairs").setup({
mappings = {
-- these mappings ensure that when trying to _close_ any of the pairs
-- it will not double insert:
-- " <- you are here. Normal pairs will do """. This config will do "".
['"'] = {
action = "closeopen",
pair = '""',
neigh_pattern = '[^\\"].',
register = { cr = false },
},
["'"] = {
action = "closeopen",
pair = "''",
neigh_pattern = "[^%a\\'].",
register = { cr = false },
},
["`"] = {
action = "closeopen",
pair = "``",
neigh_pattern = "[^\\`].",
register = { cr = false },
},
["<"] = { action = "open", pair = "<>", neigh_pattern = "\r." },
[">"] = { action = "close", pair = "<>" },
},
})
require("mini.trailspace").setup()
vim.b.miniindentscope_disable = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"lazy",
"mason",
"help",
"lspinfo",
"packer",
"checkhealth",
"man",
"gitcommit",
"TelescopePrompt",
"TelescopeResults",
"trouble",
},
callback = function()
vim.b.miniindentscope_disable = true
end,
})
require("mini.map").setup()
require("mini.move").setup()
require("mini.operators").setup()
require("mini.pairs").setup({
mappings = {
-- these mappings ensure that when trying to _close_ any of the pairs
-- it will not double insert:
-- " <- you are here. Normal pairs will do """. This config will do "".
['"'] = {
action = "closeopen",
pair = '""',
neigh_pattern = '[^\\"].',
register = { cr = false },
},
["'"] = {
action = "closeopen",
pair = "''",
neigh_pattern = "[^%a\\'].",
register = { cr = false },
},
["`"] = {
action = "closeopen",
pair = "``",
neigh_pattern = "[^\\`].",
register = { cr = false },
},
["<"] = { action = "open", pair = "<>", neigh_pattern = "\r." },
[">"] = { action = "close", pair = "<>" },
},
})
require("mini.trailspace").setup()
end,
keys = {
{
@ -288,14 +319,6 @@ return {
silent = true,
desc = "minimap",
},
{
"<leader>ss",
function()
require("mini.starter").open()
end,
silent = true,
desc = "startpage",
},
{
"<localleader>w",
function()
@ -303,16 +326,6 @@ return {
end,
desc = "Trim trailing whitespace",
},
{
"<leader>e",
function()
local mf = require("mini.files")
if not mf.close() then
mf.open()
end
end,
desc = "floating file browser",
},
{
"[si",
function()